Re: Codebabes: PHP

From: Date: Tue, 29 Apr 2014 13:38:17 +0000
Subject: Re: Codebabes: PHP
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-323218@lists.php.net to get a copy of this message
Kumar Saurabh Sinha wrote: > Difference between Language Construct & Functions: > > *Language Constructs* > Constructs are elements that are built-into the language and, therefore, > follow special > rules. ACK. > Perhaps the most common of them is the echo statement, which allows > you to write data to the script’s output: > > echo 10; // will output 10 > > It’s important to understand that echo is not a function and, as such, it > does not have > a return value. If you need to output data through a function, you can use > print() > instead: print is a language construct and not a function. Try e.g. call_user_func('print', 'foo'); However, it's interesting that print nonetheless has a return value (which always is 1). -- Christoph M. Becker

« previous php.general (#323218) next »