PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php // 闭包 $double = function($a) { return $a * 2; }; // var_dump($a); // would Warning: Undefined variable $a var_dump($double); // 这是数字范围 $numbers = range(2, 6); // array(2,3,4,5,6) echo 'var_dump($numbers):'; echo PHP_EOL; var_dump($numbers); // 这里使用闭包作为回调, // 将范围内的每个元素数值翻倍 $new_numbers = array_map($double, $numbers); echo 'var_dump($new_numbers):'; echo PHP_EOL; var_dump($new_numbers); $str = implode(' ', $new_numbers); echo PHP_EOL; print $str; $str = implode('\\', $new_numbers); echo PHP_EOL; print $str; $str = implode("\t", $new_numbers); echo PHP_EOL; print $str; ?>
Show:  
Copy Clear