close

[php] compact — 建立一個數組,包括變量名和它們的值

官方範例

<?php
$city  = "San Francisco";
$state = "CA";
$event = "SIGGRAPH";

$location_vars = array("city", "state");

$result = compact("event", "nothing_here", $location_vars);
?>

經過處理後,$result 為:

Array
(
    [event] => SIGGRAPH
    [city] => San Francisco
    [state] => CA
)


arrow
arrow
    全站熱搜

    stockwfj3 發表在 痞客邦 留言(0) 人氣()