Ask a syntax-related question

Source: Internet
Author: User
Ask a syntax question about route (, & nbsp; function () {& nbsp; echo & nbsp; hello & nbsp; world !;}); What does this mean? I have never seen such a syntax format share a question about the syntax.

Route ('/', function (){
Echo 'Hello world! ';
// What does this mean? I have never seen this syntax format.

Share: More

------ Solution --------------------
Closure, which is supported by php5.3.

Route ('/', function (){
Echo 'Hello world! ';

Route is a user-defined function. it needs to input two parameters, and the second parameter is a callback function.

For php <5.3, writeable
Route ('/', create_function (''," echo 'Hello world! ';"));

They can all be considered
Function func (){
Echo 'Hello world! ';
Route ('/', 'func ');

Abbreviated form

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