PHP array filp and array pop functions
by Jayanthi[ Edit ] 2012-06-06 14:47:47
PHP array filp and array pop functions
1. Array keys & values are flipped.
2. Get last value of array using array_pop method.
$arr = array("a" => 1, "b" => 1, "c" => 2);
$arr = array_flip($arr);
print_r($arr);
echo "
";
$new = array("one","two","three","four","five");
echo next($new); // "two"
echo "
";
$last = array_pop($new);
echo $last; // "five"
echo "
";
echo current($new); // "one"
echo "
";
?>
output
Array ( [1] => b [2] => c )
two
five
one