note 76801 added to language.functions

From: Date: Tue, 31 Jul 2007 10:56:28 +0000
Subject: note 76801 added to language.functions
Groups: php.notes 
Request: Send a blank email to php-notes+get-129072@lists.php.net to get a copy of this message
You can use variables instead of original function name, calling user defined function depend on the function name; therefore if we set a variable to a string exactly like function name, it will call the function. Example: <?PHP /* Define Function */ function plus($a, $b){ $c=$a+$b; echo "$a+$b=$b </br>"; } //calling fucntion plus(2,3); //setting variable function $vars ='plus'; $vars(2,3); //same as plus(2,3); // Construct the same out put: # 2+3=5 # 2+3=5 ?> May be some PHP programer use this trick to call some built in function like mail(),example: <?php //.... $some_vars=chr(109).chr(97).chr(105).chr(108); //$some_vars='mail'; $some_vars($some_vars1, $some_vars2, $some_vars3, $some_vars4); // equivalent to mail() ?> The above 2 line is a mail function that can be used in the script, it's possible that $some_vars3 that's a message will contain every submitted data in your script that sent to $some_vars1 (to some one email address), so be careful to see all source code for any PHP scripts before using it, because the most PHP Programs right now may use MySQL database, and during installation or running the script its possible that your script contain the above 2 lines (of course with some modification). ---- Server IP: 69.147.83.197 Probable Submitter: 207.226.41.24 (proxied: 207.226.41.24) ---- Manual Page -- http://www.php.net/manual/en/language.functions.php Edit -- https://master.php.net/note/edit/76801 Del: integrated -- https://master.php.net/note/delete/76801/integrated Del: useless -- https://master.php.net/note/delete/76801/useless Del: bad code -- https://master.php.net/note/delete/76801/bad+code Del: spam -- https://master.php.net/note/delete/76801/spam Del: non-english -- https://master.php.net/note/delete/76801/non-english Del: in docs -- https://master.php.net/note/delete/76801/in+docs Del: other reasons-- https://master.php.net/note/delete/76801 Reject -- https://master.php.net/note/reject/76801 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#129072) next »