PHP Deep Learning Note II (function built-in function)

Source: Internet
Author: User

1. Call_?user_?func_?array

Call a user-defined function, the first argument is the function name,
The second argument is that the argument to the function must be an indexed array

function Foobar ($arg, $arg 2) {    echo __function__, "Got $arg and $arg 2\n";} class Foo {    function bar ($arg, $arg 2) {        echo __method__, "Got $arg and $arg 2\n";    }} The normal function calls Call_user_func_array ("Foobar", Array ("One", "one"), and/or class member function call $foo = new Foo;call_user_func_array (Array ($foo , "Bar"), Array ("Three", "four"));




2. Call_?user_?func

Calling function arguments cannot pass reference parameters
Call_user_func (function name, parameter 1, parameter 2 ...)
Call_user_func (function ($arg) {print "[$arg]\n";}, ' Test ');



3. Create_?function

Create an anonymous function
$myfunc = create_?function (' function parameter ', ' function body ');
$myfunc (function parameters);

$newfunc = Create_function (' $a, $b ', ' return ' ln ($a) + ln ($b) = ". Log ($a * $b); echo "New anonymous function: $newfunc \ n"; Echo $newfunc (2, M_e). "\ n";



4. Forward_?static_?call_?array

Call a static function in the same way as Call_user_func_array


5. Forward_?static_?call

Call a static function in the same way as Call_user_func


6. Func_?get_?arg (Index)

Returns an item parameter of the parameter list as an indexed value


7. Func_?get_?args

Collect all parameters in an array form
 
  




8. Func_?num_?args ()

Returns the number of function pass parameters

9. function_?exists

Detects if a function exists

Function_?exists ("function name"); Detects if a function exists


Ten. Get_?defined_?functions

Returns all defined functions as a two-dimensional array
Include system functions (internal)
and user-defined functions (users)
Array (    [internal] = = Array        (            [0] = Zend_version            [1] = Func_num_args            [2] = = func_get_ Arg            [3] = Func_get_args            [4] = Strlen            [5] = strcmp            [6] = strncmp            ...            [+] = Bcscale            [751] = Bccomp        )    [user] = Array        (            [0] = myrow        ))



Register_?shutdown_?function.

Functions registered by the function when the system executes more than the maximum time fatal error
The registered function is still executed
function Add () {    code here ...} register_?shutdown_?function ("Add");
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.