note 76655 added to function.return

From: Date: Wed, 25 Jul 2007 01:13:07 +0000
Subject: note 76655 added to function.return
Groups: php.notes 
Request: Send a blank email to php-notes+get-128897@lists.php.net to get a copy of this message
regardez this code: print pewt( "hello!" ); function pewt( $arg ) { include( "some_code.inc" ); } some_code.inc: return strtoupper( $arg ); .. after much hair pulling, discovered why nothing was being returned by the "some_code.inc" code in the function .. the return simply returns the result TO the function (giving the include function a value), not to the CALLING (print pewt). This works: print pewt( "hello!" ); function pewt( $arg ) { return include( "some_code.inc" ); } So, RETURN works relative to block it is executed within. ---- Server IP: 203.220.0.234 Probable Submitter: 203.206.171.149 ---- Manual Page -- http://www.php.net/manual/en/function.return.php Edit -- https://master.php.net/note/edit/76655 Del: integrated -- https://master.php.net/note/delete/76655/integrated Del: useless -- https://master.php.net/note/delete/76655/useless Del: bad code -- https://master.php.net/note/delete/76655/bad+code Del: spam -- https://master.php.net/note/delete/76655/spam Del: non-english -- https://master.php.net/note/delete/76655/non-english Del: in docs -- https://master.php.net/note/delete/76655/in+docs Del: other reasons-- https://master.php.net/note/delete/76655 Reject -- https://master.php.net/note/reject/76655 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#128897) next »