-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi.
I've just found weird thing about in_array() function.
Platform: FreeBSD 5.1/PHP 4.3.3-RC1
Consider this code:
$this-_array_a and $this-_array_b ARE IDENTICAL
$data = array();
foreach ($this-_array_a as $key =
in_array searches for a value, you suply key. This will work as you expect:
$data = array();
foreach ($this-_array_a as $key = $value) {
if (! in_array($value, $this-_array_b)
$data['added'][$key] = $this-_array_a[$key];
}
Branko F. Grac(nar wrote:
-BEGIN PGP SIGNED
[EMAIL PROTECTED]
Marek Kilimajer:
in_array searches for a value, you suply key. This will work as you
expect:
array_key_exists searches for a key.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
3 matches
Mail list logo