php专区

 首页 > php专区 > PHP应用 > php函数大全 > php里array_work用法详解

php里array_work用法详解

分享到:
【字体:
导读:
          本次讲解 php里array_work用法,带大家深入了解 php里array_work用法 //thetestarray$array=array(php,arrays,are,cool);//somevariablefortesting:$some_var=NEW;//thefunctionthatgetscalledforeachentryfunctionformat_array_values($it...

本次讲解php里array_work用法,带大家深入了解php里array_work用法

// the test array 
$array = array(
  'php', 'arrays', 'are', 'cool' 
);
// some variable for testing:
$some_var = 'NEW';
// the function that get's called for each entry
function format_array_values(&$item, $key, $some_var) {
  $item = $some_var . ": $item (KEY: $key)
"; } // "walk" trough each array item and call the function: // "format_array_values" array_walk($array, 'format_array_values', $some_var); // print the result: print_r($array); /* The output will be: Array (   [0] => NEW: php (KEY: 0)
  [1] => NEW: arrays (KEY: 1)
  [2] => NEW: are (KEY: 2)
  [3] => NEW: cool (KEY: 3)
) */


分享到:
PHP中output_buffering详解
一、我们要说一下php中的缓存大概有哪些! 在PHP中,我们可以粗略的将缓存分为客户端缓存(Browser缓存),服务器端缓存(Server缓存)。由于PHP是基于B/S架构的,所以,我们可以理解为浏览器端的缓存,服务器端缓存。 在服务器端PHP自带的缓存中,主要可以分为两大类缓存!程序缓存和OB缓存!这也是我们学习服务器端缓存的...
php安全过滤函数大全
介绍一个php安全过滤用户输入的函数 //安全过滤输入[jb]  function check_str($string, $isurl = false)  {  $string = preg_replace('/[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F]/','',$string);  $string = str_replace(array("\0","%00","\r"),'',$string);  empty($isurl) ...
  •         php迷,一个php技术的分享社区,专属您自己的技术摘抄本、收藏夹。
  • 在这里……