Re: [PHP] Re: Preferred Syntax

2011-12-18 Thread Robert Cummings
On 11-12-17 09:42 AM, Eric Butera wrote: Hi Adam, Thanks for the reply, noted! I was coming from the angle that I've had to deal with a lot of code that is 2000 lines of php/html/javascript inside heredocs, mixed quote escaping, etc. I was hoping to prevent that from becoming a new thing in th

Re: [PHP] Re: Preferred Syntax

2011-12-17 Thread Ross McKay
On Fri, 16 Dec 2011 23:53:46 -0500, Eric Butera wrote: >To all the people who responded to this thread: >It is 2011 - please stop writing code like this. > >To the OP: >I'm glad you're asking questions and realizing you're not happy with >your current abilities and suspect there's a better way. I

Re: [PHP] Re: Preferred Syntax

2011-12-17 Thread Eric Butera
On Sat, Dec 17, 2011 at 12:59 AM, Adam Richardson wrote: > On Fri, Dec 16, 2011 at 11:53 PM, Eric Butera wrote: >> >> To all the people who responded to this thread: >> It is 2011 - please stop writing code like this. >> >> To the OP: >> I'm glad you're asking questions and realizing you're not h

Re: [PHP] Re: Preferred Syntax

2011-12-16 Thread Adam Richardson
On Fri, Dec 16, 2011 at 11:53 PM, Eric Butera wrote: > To all the people who responded to this thread: > It is 2011 - please stop writing code like this. > > To the OP: > I'm glad you're asking questions and realizing you're not happy with > your current abilities and suspect there's a better way

Re: [PHP] Re: Preferred Syntax

2011-12-16 Thread Eric Butera
On Thu, Dec 15, 2011 at 5:46 PM, Ross McKay wrote: > Jim Lucas wrote: > >>I second this example, with one minor change, I would add '{' and '}' around >>variables. >> >>echo <<>>   href="/mypage.php/{$page_id}">{$page_name} >>HTML; >> >>This works for $variables, $objects, and variable functions c

Re: [PHP] Re: Preferred Syntax

2011-12-15 Thread Ross McKay
Jim Lucas wrote: >I second this example, with one minor change, I would add '{' and '}' around >variables. > >echo << href="/mypage.php/{$page_id}">{$page_name} >HTML; > >This works for $variables, $objects, and variable functions calls. But doesn't >work if you try to call functions directly (

Re: [PHP] Re: Preferred Syntax

2011-12-15 Thread Jim Lucas
On 12/14/2011 11:50 PM, Ross McKay wrote: > On Wed, 14 Dec 2011 07:59:46 -0500, Rick Dwyer wrote: > >> Can someone tell me which of the following is preferred and why? >> >> echo "$page_name"; >> >> echo "".$page_name.""; >> [...] > > Just to throw in yet another possibility: > > echo << h

Re: [PHP] Re: Preferred Syntax

2011-12-15 Thread Louis Huppenbauer
Another nice way would be sprintf. So your string really is just a string and nothing more. I don't know how it would affect performance, but just for the eye I find it much simpler. echo sprintf("%s", $page_id, $page_name); 2011/12/15 Robert Cummings > On 11-12-15 02:50 AM, Ross McKay wrote: >

Re: [PHP] Re: Preferred Syntax

2011-12-15 Thread Robert Cummings
On 11-12-15 02:50 AM, Ross McKay wrote: On Wed, 14 Dec 2011 07:59:46 -0500, Rick Dwyer wrote: Can someone tell me which of the following is preferred and why? echo "$page_name"; echo "".$page_name.""; [...] Just to throw in yet another possibility: echo<<$page_name HTML; I love HEREDO

[PHP] Re: Preferred Syntax

2011-12-14 Thread Ross McKay
On Wed, 14 Dec 2011 07:59:46 -0500, Rick Dwyer wrote: >Can someone tell me which of the following is preferred and why? > > echo "$page_name"; > > echo "".$page_name.""; >[...] Just to throw in yet another possibility: echo <<$page_name HTML; I love HEREDOC for slabs of HTML, sometimes SQL, e

Re: [PHP] Re: Preferred Syntax

2011-12-14 Thread Peter Ford
On 14/12/11 16:48, Al wrote: On 12/14/2011 7:59 AM, Rick Dwyer wrote: Hello all. Can someone tell me which of the following is preferred and why? echo "$page_name"; echo "".$page_name.""; When I come across the above code in line 1, I have been changing it to what you see in line 2 for no

[PHP] Re: Preferred Syntax

2011-12-14 Thread Al
On 12/14/2011 7:59 AM, Rick Dwyer wrote: Hello all. Can someone tell me which of the following is preferred and why? echo "$page_name"; echo "".$page_name.""; When I come across the above code in line 1, I have been changing it to what you see in line 2 for no other reason than it delineate