PHP Return statement alternative usage is not only in the function

Source: Internet
Author: User
Tags require bbpress

Share another function of the PHP return statement, a wonderful way to see it in the Bbpress code.

Always assume that return can only appear in the function until you see the bbpress code:

<?php

Require_once ('./bb-load.php ');

Bb_repermalink (); The magic happens here.

if ($self) {

if (Strpos ($self, '. php ')!== false) {

Require ($self);

} else {

Require (Bb_path. ' profile-base.php ');

}//Www.jb51.net

Return

}

Does return still appear outside the function? This is unthinkable in C language.

Checked the PHP manual: If you call the return statement in a function, it ends the execution of the function immediately and returns its arguments as the value of the function. If invoked in the global scope, the current script file aborts.

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.