PHPreturn statement alternative usage, phpreturn statement alternative _ PHP Tutorial

Source: Internet
Author: User
Tags bbpress
PHPreturn statements have different usage and phpreturn statements. The PHPreturn statement is an alternative usage. the phpreturn statement is another function of the PHPreturn statement under the PHPreturn statement. it is a wonderful usage method seen in the bbPress code. I always thought that the return statement is an alternative use only for PHP return statements, and the phpreturn statement is an alternative

Share Another role of the PHP return statement, which is a wonderful way to use in the bbPress code.

I always thought that return can only appear in the function until I read the bbPress code:

 

Can return still appear outside of the function? This is unimaginable in the C language.

Check the PHP Manual: if a return statement is called in a function, the execution of the function is immediately ended and its parameters are returned as the function value. If it is called globally, the current script file stops running.


Problems with using the return statement in PHP

Return is returned.
Echo is the output. You can also print
Return is not an output,

The return statement in php functions

Yes. according to the logical relationship, when a return statement is executed, the return statement is returned and the subsequent statement is not executed. if a return statement is not executed, the subsequent statements may be executed.
However, the second return in this program is useless and will never be executed.

Http://www.bkjia.com/PHPjc/854730.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/854730.htmlTechArticlePHP return statement alternative usage, phpreturn statement alternative share another role of PHP return statement, in the bbPress code to see a wonderful way to use. Always thought, return only...

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.