Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

list function PHP


<?php

$info = array('coffee', 'brown', 'caffeine');

// Listing all the variables
list($drink, $color, $power) = $info;
echo "$drink is $color and $power makes it special.
";

// Listing some of them
list($drink, , $power) = $info;
echo "$drink has $power.
";

// Or let's skip to only the third one
list( , , $power) = $info;
echo "I need $power!
";

// list() doesn't work with strings
list($bar) = "abcde";
var_dump($bar); // NULL
?>

Source by www.php.net #
 
PREVIOUS NEXT
Tagged: #list #function #PHP
ADD COMMENT
Topic
Name
1+5 =