note 62211 modified in function.in-array by danbrown

From: Date: Mon, 08 Jun 2009 21:44:23 +0000
Subject: note 62211 modified in function.in-array by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-156514@lists.php.net to get a copy of this message
Sorry, that deep_in_array() was a bit broken. <?php function deep_in_array($value, $array) { foreach($array as $item) { if(!is_array($item)) { if ($item == $value) return true; else continue; } if(in_array($value, $item)) return true; else if(deep_in_array($value, $item)) return true; } return false; } ?> --was-- Sorry, that deep_in_array() was a bit broken. <? function deep_in_array($value, $array) { foreach($array as $item) { if(!is_array($item)) { if ($item == $value) return true; else continue; } if(in_array($value, $item)) return true; else if(deep_in_array($value, $item)) return true; } return false; } ?> http://php.net/manual/en/function.in-array.php

« previous php.notes (#156514) next »