Re: Codebabes: PHP
| From: | Shawn McKenzie | Date: | Tue, 29 Apr 2014 14:09:40 +0000 |
| Subject: | Re: Codebabes: PHP | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-323221@lists.php.net to get a copy of this message | ||
Also, they cannot be called using variable functions. Notice however that
though echo doesn't return a value, print does.
On Tue, Apr 29, 2014 at 7:46 AM, Kumar Saurabh Sinha <
sinha.ksaurabh@gmail.com> wrote:
> Difference between Language Construct & Functions:
>
> *Language Constructs*
> Constructs are elements that are built-into the language and, therefore,
> follow special
> rules. 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:
>
> echo 10;print (10);
>
> Another very important construct is die(), which is itself an alias of
> exit(). It allows
> you to terminate the script’s output and either output a string or return a
> numeric
> status to the process that called the script.
>
> Thanks & Regards
>
> *Kumar Saurabh Sinha*
> +91-9971047719 | +91-8595436700
>
>
>
> On Tue, Apr 29, 2014 at 6:03 PM, Tedd Sperling <tedd@sperling.com> wrote:
>
> > On Apr 28, 2014, at 3:32 PM, Robert Cummings <robert@interjinn.com>
> wrote:
> > > On 14-04-28 03:30 PM, Robert Cummings wrote:
> > >> They should push the use of echo over print since it's a language
> > >> construct and not a function thus it benefits from no function
> overhead.
> > >>
> > >> Cheers,
> > >> Rob.
> > >
> > > I'd like to retract this comment :) Apparent print is not a function.
> > Didn't it used to be?
> > >
> > > Cheers,
> > > Rob.
> > > --
> >
> > Nope, you can't retract it. :-)
> >
> > As for "print" being a function or construct, I dunno -- what's the
> > difference?
> >
> > Cheers,
> >
> > tedd
> >
> >
> > _______________
> > tedd sperling
> > tedd@sperling.com
> >
> >
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>