http://www.php.net/extract
http://www.php.net/compact
// extract() $array = ['k' => 'v', 'k2' => 'v2']; extract($array); // 第二、第三引数次第で、接頭辞の指定もできます echo $k, $k2; // vv2 // compact() $x = 'X'; $y = 'Y'; print_r(compact('x', 'y')); /* Array ( [x] => X [y] => Y ) */ print_r(compact(['x', 'y'])); /* Array ( [x] => X [y] => Y ) */
No comments:
Post a Comment