RE: [PHP-NOTES] note 24482 added to function.is-array

From: Date: Sat, 17 Aug 2002 23:00:04 +0000
Subject: RE: [PHP-NOTES] note 24482 added to function.is-array
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-35185@lists.php.net to get a copy of this message
> $as_ar = array( > array("me" => "5", "you"=>"6", > "him" => "3", "her"=>"2", "us"=>"4", > 12, 8), > "lone"=>9, > array("red"=>"3", "yellow"=>"4", > "green"=>"5", "cyan"=>"6", > "blue"=>"3", "purple"=>"3.2"), > array("east"=>"2", "west"=>"3", > "south"=>"4", "north"=>"5", > "up"=>"6", "down"=>"8", > "come"=>"10", "go"=>"1") > ); > > if (is_array($as_ar[1])){ > echo "The second element is an array."; > } Where is the element [1]? It is wrong to check this way because you actually defined the element with name 'lone'. So, for your test you should do: if (is_array($as_ar['lone'])){ echo "The second element is an array."; } And, anyhow, your exact example did not print me anything. So, whether you missed out the point or it is a bug. If it is a bug, I suggest you to report it at bugs.php.net. P.S: an advice: use always error_reporting(E_ALL | E_NOTICE); Maxim Maletsky maxim@php.net

« previous php.notes (#35185) next »