PHP variable reference PHP function reference Transfer considerations analysis

Source: Internet
Author: User
This article describes the reference delivery considerations for PHP function transfer values. Share to everyone for your reference, as follows:

Strict standards:only variables should be passed by reference

Online to find the information there is such a sentence:

In php5.3 above version of this problem, should also be related to the configuration of PHP, as long as the sentence to split into two sentences there is no problem. because the arguments of Array_walk are passed by reference, more than 5.3 by default can only pass specific variables, and cannot return a value through a function. Of course you can also modify the error_reporting in php.ini = E_all | E_strict, but it does not conform to the norm.

$suffix = Array_pop (Explode (".", $file _name));

Why is the higher version of this restriction?

I'll go see the function prototypes in the manual:

Mixed Array_pop (array & $array) bool Array_walk (array & $array, callable $funcname [, mixed $userdata = NULL] )

The & symbol specifies that the variable is passed in and is referenced.

Switch

$file _name_arr = Explode (".", $file _name); $suffix = Array_pop ($file _name_arr);

We can.

In fact, it's just a warning. is not a fatal error. The normal result is to be able to get. For example, it is normal to get the suffix of the file name here.

More readers interested in PHP related content can view the topic: "PHP Primer for Object-oriented programming", "PHP Math Skills Summary", "PHP operation Office Document Skills Summary (including word,excel,access,ppt)", "PHP Array ( Array), "PHP Data structure and algorithm tutorial", "PHP Programming Algorithm Summary", "PHP Regular Expression Usage Summary", and "PHP Common database Operation Skills Summary"

I hope this article is helpful to you in PHP programming.

The above describes the PHP variable reference PHP function value of the reference transfer considerations analysis, including the PHP variable reference content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.