Re: Codebabes: PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> 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@xxxxxxxxxxxx> wrote:
>
> > On Apr 28, 2014, at 3:32 PM, Robert Cummings <robert@xxxxxxxxxxxxx>
> 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@xxxxxxxxxxxx
> >
> >
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux