note 44935 deleted from function.array-search by tomsommer

From: Date: Fri, 20 Aug 2004 18:08:09 +0000
Subject: note 44935 deleted from function.array-search by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-75012@lists.php.net to get a copy of this message
Note Submitter: lsblsb at gmx dot de [germany] ---- cause i changed one part minutes before i posted, although the code was ok, an error was caused by an php-function (array_search), that interprets "1" like true, and "0" like false. Sorry for that. here the working original function (without array_search): function draw_tree($node_arr, $akt_node="") { if(!empty($node_arr)) { for($i=0; $i<10; $i++) { $tmp_node = $akt_node.$i; $in_array = false; for($j=0; $j<count($node_arr); $j++) { if($node_arr[$j] === $tmp_node) { $in_array = true; } } if($in_array) { $depth = strlen($tmp_node)-1; echo(str_repeat(">",$depth).$tmp_node."<br>"); draw_tree($node_arr, $tmp_node); } } } }

« previous php.notes (#75012) next »