Re: echo vs print (was echo vs printf)

From: Date: Mon, 16 Jul 2001 16:02:27 +0000
Subject: Re: echo vs print (was echo vs printf)
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-58069@lists.php.net to get a copy of this message
Ummm. I am not sure about either having a return value... but print "you have $points points"; and echo "you have $points points"; have identical output. You can drop a variable into an echo statement with no problem Sheridan ----- Original Message ----- From: Steve Brett <steve.brett@e-mis.com> To: <php-general@lists.php.net> Sent: Monday, July 16, 2001 10:48 AM Subject: Re: [PHP] echo vs printf > i seem to remember reading somewhere that print acts like (is) a function, > presumably returning false if it cannot print to screen, whereas echo just > dumps it. > > also you can drop vars in print like > > print "you have $points points"; > > whereas to echo it you'd have to concatenate the string. > > Steve > > > "Don Read" <dread@texas.net> wrote in message > news:XFMail.010716104339.dread@texas.net... > > > > On 16-Jul-01 brother wrote: > > > Why should I use printf instead of echo and vice versa? > > > > > > > printf print-formated > > > > $a=12.3456; > > > > echo $a, '<BR>'; > > printf('%1.2f<BR>', $a); > > > > 12.3456<BR> > > 12.34<BR> > > > > > As for today I use printf mostly but I don't know why. > > > > You prolly mean print; There may be some minor differences from echo, > > but i've never seen 'em. > > (i think they threw print in PHP to keep JAPHs happy). > > > > Regards, > > -- > > Don Read dread@texas.net > > -- It's always darkest before the dawn. So if you are going to > > steal the neighbor's newspaper, that's the time to do it. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#58069) next »