How does this array filter the results according to the specified criteria?

$allnodes=[
            0 =>["userid" => 10012,"lft" => 4,"rgt" => 5,"rank" => 1],
            1 =>["userid" => 10006,"lft" => 6,"rgt" => 7,"rank" => 2],
            2 =>["userid" => 10011,"lft" => 14,"rgt" => 15,"rank" => 3],
            3 =>["userid" => 10008,"lft" => 16,"rgt" => 19,"rank" => 1],
            4 =>["userid" => 10013,"lft" => 22,"rgt" => 23,"rank" => 1]
          ];

how to find the result set corresponding to lft+rgt < = 27. The correct result should be line 0pl.

is there any efficient algorithm? I remember that in c-sharp, it seems that you can turn this form into a virtual table, and you can use SQL statements. Check directly in memory without linking to the database. Does it seem that it can only be ergodic in php?

foreach should be able to calculate quickly, traversing line by line. Is there a built-in php array function that can be worked out without a loop?

Php
Apr.11,2021

it's impossible not to use a loop, it's still a loop inside the array_filter

var_dump(array_filter($allnodes, function($v) {
    return $v['lft'] + $v['rgt'] < 27;
}));
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3fbe9-2c4c5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3fbe9-2c4c5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?