|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-02-04 13:45 UTC] sven at leon dot uia dot mx
[2006-04-03 12:36 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 10:00:02 2025 UTC |
Description: ------------ I have a number of feature requests: 1) Could it be possible to immediately access an array that was returned from a function, just like its possible to access object functions immediately? This way its easy to safely access arrays that are privately stored inside an object (so that another person can not (accidentally) change information inside that array. i.e. $temp=$object->return_object($parameter)->data($key); for an array (that is privately kept inside an object): $temp=$object->return_array($parameter)[$key]; where $object->return_array would be like: function return_array(){ return $copied_array=$private_array; } This same (feature request) has been asked in report 25898, but the given "possible solution" did not seem to match my question. 2) Could it be possible for functions that accept parameters by reference, and return values by reference, to also accept static value's like strings or booleans? This would be very nice in situations where I would have to accept a large string PLUS a small piece of text like "hey", and it would be very usefull too in situations where I would have to return either an array or FALSE. like this: $data="hey"; test(TRUE, $data."<br>"); function test($param1, &$param2){ $data=array($param2, "bye"); If($param1) { return $data; } else { return FALSE; } } The above script will fail with beta 3 on both the parameters (since a static string was part of $param2) and the return value (Becouse FALSE is also not a variable) This is a functionality I have used alot in other programming languages, without problems. Sending strings by reference will (in my opinion) make it possible to optimize your scripts a little more.