note 91482 added to language.pseudo-types
| From: | phpguy at lifetoward dot com | Date: | Fri, 12 Jun 2009 00:44:44 +0000 |
| Subject: | note 91482 added to language.pseudo-types | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-156792@lists.php.net to get a copy of this message | ||
I noticed two important thing about putting callbacks into an arg list when calling a function:
1. The function to which the callback refers must be defined earlier in the source stream. So for
example:
function main() {...; usort($array, 'sortfunction'); ... }
function sortfunction($a, $b){ return 0; }
Will NOT work, but this will:
function sortfunction($a, $b){ return 0; }
function main() {...; usort($array, 'sortfunction'); ... }
2. It's not really just a string. For example, this doesn't work:
usort($array, ($reverse?'reversesorter':'forwardsorter'));
I found these two discoveries quite counterintuitive.
----
Server IP: 64.71.164.2
Probable Submitter: 70.231.134.116
----
Manual Page -- http://www.php.net/manual/en/language.pseudo-types.php
Edit -- https://master.php.net/note/edit/91482
Del: integrated -- https://master.php.net/note/delete/91482/integrated
Del: useless -- https://master.php.net/note/delete/91482/useless
Del: bad code -- https://master.php.net/note/delete/91482/bad+code
Del: spam -- https://master.php.net/note/delete/91482/spam
Del: non-english -- https://master.php.net/note/delete/91482/non-english
Del: in docs -- https://master.php.net/note/delete/91482/in+docs
Del: other reasons-- https://master.php.net/note/delete/91482
Reject -- https://master.php.net/note/reject/91482
Search -- https://master.php.net/manage/user-notes.php