note 44935 added to function.array-search

From: Date: Fri, 20 Aug 2004 15:39:47 +0000
Subject: note 44935 added to function.array-search
Groups: php.notes 
Request: Send a blank email to php-notes+get-75000@lists.php.net to get a copy of this message
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); } } } } ---- Manual Page -- http://www.php.net/manual/en/function.array-search.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+44935 Delete -- http://master.php.net/manage/user-notes.php?action=delete+44935&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+44935&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#75000) next »