note 36255 deleted from function.ereg by didou

From: Date: Thu, 02 Oct 2003 13:58:33 +0000
Subject: note 36255 deleted from function.ereg by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-57611@lists.php.net to get a copy of this message
Note Submitter: andrec69@excite.co.jp ---- About Erik's problem: >This function doesn't allow the use of list($reg1,$reg2) in stead of the $regs array as a >last argument. >The list() array helper works perfectly in a while loop, but in an ereg() it will report a >syntax error. List is not a function. It is a "language construct" as they say at: http://www.php.net/manual/en/function.list.php I believe that internaly, when you say: <?php list($var1, $var2) = $arr; ?> You are actually calling some function like this: _LIST ($arr, $var1, $var2) Here $arr is an argument of _LIST! The symbol '=' is part of the "function" list. (ie: list has to have this form: "list() =") I also belive that internaly this function is probably defined as something like: (assuming c++) <? // This is not PHP! (I just want it to be colored) mixed& _LIST (mixed& arr, mixed& var1, ...) { n = get_n_args_somehow(); for (int i=1; i < n; i++) { argument[i] = arr[i-1]; } /* * if "arr" is FALSE, the return is also FALSE! * for this reason you can use list() inside a "while". */ return arr; } ?> Andre Caldas.

« previous php.notes (#57611) next »