PHP ʖ²ἯTH
º/A
list
˵÷
=ד 1. list() =ד
?php $info = array('coffee', 'brown', 'caffeine'); // Listing all the variables list($drink, $color, $power) = $info; print "$drink is $color and $power makes it special.\n"; // Listing some of them list($drink,, $power) = $info; print "$drink has $power.\n"; // Or let's skip to only the third one list(,, $power) = $info; print "I need $power!\n";?
=ד 2. ʹӃ list() µĀÿ¼¯
table tr th Employee name /th th Salary /th /tr ?php $result = mysql_query ("SELECT id, name, salary FROM employees",$conn); while (list ($id, $name, $salary) = mysql_fetch_row ($result)) {print (" tr \n". "td a href=\"info.php?id=$id\" $name /a /td \n"." td $salary /td \n". "/tr \n");}? /table
¾¯¸漯B
=ד 3. Ԛ list() ʹӃʽש˷ҽ
?php $info = array('coffee', 'brown', 'caffeine'); list($a[0], $a[1], $a[2]) = $info; var_dump($a);?
array(3) {[2]= string(8) "caffeine" [1]= string(5) "brown" [0]= string(6) "coffee"}
º/A
ưµ㼯A
ksort
ɏһ¼¶
natcasesort