can you just do
```// Check tree level
$current_level = ($row['rule_id'] == $parent_id) ? true : false;```