Helpful php array functions
Sunday, 3 August, 2008 - 20:55
Just when you think you know php. You find these helpful array function.
in_array()
http://au2.php.net/in_array
array_key_exists()
http://au.php.net/array_key_exists
more array functions:
http://au.php.net/manual/en/ref.array.php
$value = array( [0] => 6 [1] => 5 [2] => 4 );
$k = 4;
$checked = false;
if(is_array($value))
{
if(in_array($k, $value))
{
$checked = true;
}
else
{
$checked = false;
}
}
Category:
Add new comment