note 65309 added to function.return

From: Date: Fri, 28 Apr 2006 14:19:25 +0000
Subject: note 65309 added to function.return
Groups: php.notes 
Request: Send a blank email to php-notes+get-109984@lists.php.net to get a copy of this message
Little lollypop about "return" behaviour in "require_once","include_once" etc. When you write return construction in included file, like this one: -- included.php ----- <? return 2; ?> -- eof included.php ----- and then include it using "require_once": -- includer.php ----- <? echo require_once("included.php") . "\r\n"; echo require_once("included.php") . "\r\n"; ?> -- eof includer.php ----- You will see "2 1". In other words, require_once call to already included file always returns value "1", whatever you return from this file. ---- Server IP: 64.71.164.2 Probable Submitter: 195.34.56.170 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.return.php Edit -- http://master.php.net/note/edit/65309 Del: integrated -- http://master.php.net/note/delete/65309/integrated Del: useless -- http://master.php.net/note/delete/65309/useless Del: bad code -- http://master.php.net/note/delete/65309/bad+code Del: spam -- http://master.php.net/note/delete/65309/spam Del: non-english -- http://master.php.net/note/delete/65309/non-english Del: in docs -- http://master.php.net/note/delete/65309/in+docs Del: other reasons-- http://master.php.net/note/delete/65309 Reject -- http://master.php.net/note/reject/65309 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#109984) next »