note 103480 added to function.compact

From: Date: Fri, 15 Apr 2011 13:00:24 +0000
Subject: note 103480 added to function.compact
Groups: php.notes 
Request: Send a blank email to php-notes+get-178871@lists.php.net to get a copy of this message
A quick way of compacting all local variables: <?php $localVariables = compact(array_keys(get_defined_vars())); ?> This is useful if you want to return all local variables from a function/method or you want to pass all local variables to one. A valid example would be to use this with application hooks/events (if you want the called hook to be able to modify everything in the caller), but otherwise use with care (as methods should be used through their declared interface). ---- Server IP: 69.147.83.197 Probable Submitter: 82.131.129.28 ---- Manual Page -- http://www.php.net/manual/en/function.compact.php Edit -- https://master.php.net/note/edit/103480 Del: integrated -- https://master.php.net/note/delete/103480/integrated Del: useless -- https://master.php.net/note/delete/103480/useless Del: bad code -- https://master.php.net/note/delete/103480/bad+code Del: spam -- https://master.php.net/note/delete/103480/spam Del: non-english -- https://master.php.net/note/delete/103480/non-english Del: in docs -- https://master.php.net/note/delete/103480/in+docs Del: other reasons-- https://master.php.net/note/delete/103480 Reject -- https://master.php.net/note/reject/103480 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#178871) next »