note 105551 added to language.references.arent

From: Date: Fri, 26 Aug 2011 14:34:46 +0000
Subject: note 105551 added to language.references.arent
Groups: php.notes 
Request: Send a blank email to php-notes+get-182757@lists.php.net to get a copy of this message
In C++/Java I was unable to make a function that swaps two variables. If the two variables were pointers, then I was able to make a function that swaps the values pointed to by the pointers, but not the pointers themselves. In php it looks like I can do swap(int,int) : The page below will show $a: a $b: b $a: b $b: a <?php function swap(&$first, &$second) { $tmp = $first; $first = $second; $second = $tmp; } $a = "a"; $b = "b"; echo "\$a: $a <br/>"; echo "\$b: $b <br/>"; swap($a, $b); echo "\$a: $a <br/>"; echo "\$b: $b <br/>"; ?> ---- Server IP: 69.147.83.197 Probable Submitter: 46.44.146.234 ---- Manual Page -- http://www.php.net/manual/en/language.references.arent.php Edit -- https://master.php.net/note/edit/105551 Del: integrated -- https://master.php.net/note/delete/105551/integrated Del: useless -- https://master.php.net/note/delete/105551/useless Del: bad code -- https://master.php.net/note/delete/105551/bad+code Del: spam -- https://master.php.net/note/delete/105551/spam Del: non-english -- https://master.php.net/note/delete/105551/non-english Del: in docs -- https://master.php.net/note/delete/105551/in+docs Del: other reasons-- https://master.php.net/note/delete/105551 Reject -- https://master.php.net/note/reject/105551 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#182757) next »