Re: [PHP] a shortcut to set variable

2011-04-12 Thread Richard Quadling
On 12 April 2011 20:00, David Harkness wrote: > On Tue, Apr 12, 2011 at 6:34 AM, Richard Quadling > wrote: >> >> Without running the code, can you say what the output will be in the 3 >> examples? > > Yes, but I would still rewrite that code. ;) I typically reserve the ternary > operator to retur

Re: [PHP] a shortcut to set variable

2011-04-12 Thread David Harkness
On Tue, Apr 12, 2011 at 6:34 AM, Richard Quadling wrote: > Without running the code, can you say what the output will be in the 3 > examples? > Yes, but I would still rewrite that code. ;) I typically reserve the ternary operator to return a value or assign a variable. Given that it is used less

Re: [PHP] a shortcut to set variable

2011-04-12 Thread Richard Quadling
On 12 April 2011 14:25, tedd wrote: > At 12:47 PM +0100 4/12/11, Richard Quadling wrote: >> >> Putting () around ternary's is a "best practise". >> >> > echo 'Are we ready to go? ', isset($go) ? 'Yes we are.' : 'No we are >> not.', ' Ready state completed', PHP_EOL; >> $go = true; >> echo 'Are we

Re: [PHP] a shortcut to set variable

2011-04-12 Thread tedd
At 12:47 PM +0100 4/12/11, Richard Quadling wrote: Putting () around ternary's is a "best practise". vs. vs. Don't run them just yet. Can you quickly and easily see the output? Argg! :-) $ready = 'Are we ready to go? '; $yes = 'Yes we are.'; $no = 'No we are not.' echo($ready); ech

Re: [PHP] a shortcut to set variable

2011-04-12 Thread Richard Quadling
On 12 April 2011 11:57, Stuart Dallas wrote: > On Tuesday, 12 April 2011 at 11:52, tedd wrote: > At 11:06 AM +0100 4/12/11, Stuart Dallas wrote: >> > On Tuesday, 12 April 2011 at 10:36, Joe Francis wrote: >> > eh, I just want to get a shortcut like >> > > >> > >  $id = isset($_GET['id']) ? $_GET['

Re: [PHP] a shortcut to set variable

2011-04-12 Thread Stuart Dallas
On Tuesday, 12 April 2011 at 11:52, tedd wrote: At 11:06 AM +0100 4/12/11, Stuart Dallas wrote: > > On Tuesday, 12 April 2011 at 10:36, Joe Francis wrote: > > eh, I just want to get a shortcut like > > > > > > $id = isset($_GET['id']) ? $_GET['id'] : 0; > > > > > > > > > BTW, I'm using PHP5.3+

Re: [PHP] a shortcut to set variable

2011-04-12 Thread tedd
At 11:06 AM +0100 4/12/11, Stuart Dallas wrote: On Tuesday, 12 April 2011 at 10:36, Joe Francis wrote: eh, I just want to get a shortcut like $id = isset($_GET['id']) ? $_GET['id'] : 0; BTW, I'm using PHP5.3+, thanks bros. http://stut.net/2011/04/12/php-snippet-array-element-access/ -Stu

Re: [PHP] a shortcut to set variable

2011-04-12 Thread Stuart Dallas
On Tuesday, 12 April 2011 at 10:36, Joe Francis wrote: eh, I just want to get a shortcut like > > $id = isset($_GET['id']) ? $_GET['id'] : 0; > > > BTW, I'm using PHP5.3+, thanks bros. http://stut.net/2011/04/12/php-snippet-array-element-access/ -Stuart -- Stuart Dallas 3ft9 Ltd http://3ft9.

[PHP] a shortcut to set variable

2011-04-12 Thread Joe Francis
eh, I just want to get a shortcut like $id = isset($_GET['id']) ? $_GET['id'] : 0; BTW, I'm using PHP5.3+, thanks bros. -- Powered By Francis™. Welcome to my website: http://www.francistm.com Rewrite to francis...@gmail.com please.