Re: Syntax Snag need extra eyes (RESOLVED)

From: Date: Thu, 16 Jul 2009 16:36:57 +0000
Subject: Re: Syntax Snag need extra eyes (RESOLVED)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-295479@lists.php.net to get a copy of this message
Miller, Terion wrote: > Thanks Jim!! I did read the manual and don't get it, like why is printf used and not > echo...how do you decided which to use? > > > > On 7/16/09 11:25 AM, "Jim Lucas" <lists@cmsws.com> wrote: > > printf( > '<a href="view.php?name=%s"><b>%s</b><br > />%s<br /><br /></a>', > $row['name'], > $row['name'], > $row['address'] > ); > I would say personal preference is the main factor. I use echo mostly. Some people like print() and some line printf() & sprintf(). Probably depends mostly on where you learned to program. Honestly, echo and print() use the same internal PHP construct. From what I understand, one links to the other as an alias or something to that affect. Also, the parenthesis are optional when using echo and print. Back in the day, to be consistent, most people used printf() in C or other similar programming languages. Jim Lucas

« previous php.general (#295479) next »