[PHP] echo, print and is_callable()/function_exists()
Because both echo and print are language constructs and not actual functions, you can't seem to use either is_callable() or function_exists() on either to determine if they are valid 'function' calls. Is there any other way to determine to check to see if I can execute either or? I'm writing a version of array_walk_recursive() (it doesn't exist in the version of PHP we are using) and if I try to pass in either echo or print as the function, nothing ever happens because neither resolves as an executable function... Any ideas as to how I can get around this? thnx, Chris
Re: [PHP] echo, print and is_callable()/function_exists()
Just wrap it, like Example 1 of the manual shows function my_echo($array, $key) { echo $array[$key]; } array_walk_recursive($array, 'my_echo'); Date: Fri, 7 Apr 2006 15:42:40 +0100 From: Chris Boget [EMAIL PROTECTED] To: php-general@lists.php.net Subject: [PHP] echo, print and is_callable()/function_exists() Because both echo and print are language constructs and not actual functions, you can't seem to use either is_callable() or function_exists() on either to determine if they are valid 'function' calls. Is there any other way to determine to check to see if I can execute either or? I'm writing a version of array_walk_recursive() (it doesn't exist in the version of PHP we are using) and if I try to pass in either echo or print as the function, nothing ever happens because neither resolves as an executable function... Any ideas as to how I can get around this? thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Echo/Print
I am fairly new to PHP Scripting, and I am learning from a book. Throughout the book, print is used as the basic command to output text/variables.. yet I see almost everyone in here uses echo. Might I ask what the differences of the two are, and if there are any benefits of using one over the other? Thanks, Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Echo/Print
Thanks! Helped a lot. -Andy Jeff Oien [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... You can read the notes lower on the page here to get a good idea: http://www.php.net/manual/en/function.print.php Jeff Oien I am fairly new to PHP Scripting, and I am learning from a book. Throughout the book, print is used as the basic command to output text/variables.. yet I see almost everyone in here uses echo. Might I ask what the differences of the two are, and if there are any benefits of using one over the other? Thanks, Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]