显示下拉菜单

Configuration of array_map() 本页面仅提供英文版本。

<?php
/**
 * PHP By Example
 *
 * @copyright 2014 Michel Corne 
 * @license   http://www.opensource.org/licenses/gpl-3.0.html GNU GPL v3
 */

require_once 'models/function_core.php';

/**
 * Function configuration
 *
 * @see docs/function-configuration.txt
 */

class array_map extends function_core
{
    public 
$examples = [
        [
            
'cube',
            [
12345],
        ],
        [
            
'double',
            [
12345],
        ],
        [
            
'show_Spanish',
            [
12345],
            [
"uno""dos""tres""cuatro""cinco"],
        ],
        [
            
'map_Spanish',
            [
12345],
            [
"uno""dos""tres""cuatro""cinco"],
        ],
        [
            
null,
            [
12345],
            [
"one""two""three""four""five"],
            [
"uno""dos""tres""cuatro""cinco"],
        ],
        [
            
'cb1',
            [
"stringkey" => "value"],
        ],
        [
            
'cb2',
            [
"stringkey" => "value"],
            [
"stringkey" => "value"],
        ],
        [
            
null,
            [
"stringkey" => "value"],
        ],
        [
            
null,
            [
"stringkey" => "value"],
            [
"stringkey" => "value"],
        ],
    ];

    public 
$helper_callbacks = ['index_in_example' => 0'function_name_pattern' => '~(^str[ifprst])~'];

    public 
$source_code '
        // custom callback functions
        function cube($n)             { return($n * $n * $n); };
        function double($value)       { return $value * 2; };
        function show_Spanish($n, $m) { return("The number $n is called $m in Spanish"); };
        function map_Spanish($n, $m)  { return(array($n => $m)); };
        function cb1($a)              { return array ($a); };
        function cb2($a, $b)          { return array ($a, $b); };

        inject_function_call
    '
;

    public 
$synopsis       'array array_map ( callable $callback , array $array1 [, array $... ] )';
    public 
$synopsis_fixed 'array array_map ( callable $callback , array $array1 [, array $array2 [, array $array3 ]] )';

    function 
pre_exec_function()
    {
        
$this->_filter->filter_callback('callback');
    }
}