PHP return Statement
PHP return statement immediately terminates the execution of a function when it is called from within that function.
This function is also used to terminate the execution of an eval() function or script file.
If this function is called from a global scope, the function stops the execution of the current script. If the current script file was included using include() or required(), then control goes back to the calling file.
Where expression is any valid expression. Note that, since the return is not a function but a language construct, using parenthesis is not required.
|If called from within a function||Returns the argument of the function.|
|If the current script file was included using include() or required()||Value given to return().|
|If no parameter is supplied||NULL is returned.|
Code of p.php
<?php include("q.php"); echo "p"; ?>
Code of q.php
<?php echo "q"; return; ?>
PHP: Tips of the Day
PHP: PHP Constants Containing Arrays?
NOTE: while this is the accepted answer, it's worth noting that in PHP 5.6+ you can have const arrays
You can also serialize your array and then put it into the constant:
# define constant, serialize array define ("FRUITS", serialize (array ("apple", "cherry", "banana"))); # use it $my_fruits = unserialize (FRUITS);
Ref : https://bit.ly/2EcIer8
- New Content published on w3resource :
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework