Some less common features of PHP

Source: Internet
Author: User
Some of the less common features of PHP 1. variable function name. you can concatenate the function name functionaa ($ str) {echo $ str ;}$ functionaa; $ function (Hello); ORcall_user_func ($ function, $ param ); 2. list all functions and determine whether a function is a common feature of PHP.

1. variable function name, which can be concatenated with a string

function aa($str) {  echo $str;}$function = "aa";$function('Hello');// ORcall_user_func($function, $param);

2. list all functions and determine whether a function exists.

get_defined_functions()function_exist()

3. accept PUT requests, essential for PHP REST

parse_str(file_get_contents('php://input'), $put_vars);

4. parse time from string

echo date('Y-m-d', strtotime('-1 month ago'));

5. View and call backtrace in DEBUG

$backtrace = debug_backtrace();var_export($backtrace[0])die();

6. interactive command line, command line execution PHP

Php-a and php-r 'echo "hello ";'

For more information, see php-h.

7. memory usage detection

memory_get_peak_usage()memory_get_usage()

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.