note 79846 deleted from function.return by felipe

From: Date: Sat, 15 Dec 2007 15:06:55 +0000
Subject: note 79846 deleted from function.return by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-133541@lists.php.net to get a copy of this message
Note Submitter: drenintell ---- Salute, When an "included" script finishes executing and there is no return statement in the script, the returned value to the parent script is int(1), and not bool(true) Example 1: <?php # a.php $b= include_once( 'b.php' ); var_dump( $b ); # Outputs: int(1) 1 ?> <?php # b.php # This script is empty ?> If on the other hand you had an empty return statement in an "included" script, the returned value to the parent script is NULL Example 2: <?php # a.php $b= include_once( 'b.php' ); var_dump( $b ); # Outputs: NULL ?> <?php # b.php return; ?> And finally, Example 3: <?php # a.php $b= include_once( 'b.php' ); var_dump( $b ); # Outputs: int(1) 1 ?> <?php # b.php return 1; ?> This last example has the same output as Example 1. Something worth noting. Regards, drenintell

« previous php.notes (#133541) next »