<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:series="http://unfoldingneurons.com/"
> <channel><title>Comments on: PHP Shorthand If / Else&#160;Examples</title> <atom:link href="http://davidwalsh.name/javascript-shorthand-if-else-examples/feed" rel="self" type="application/rss+xml" /><link>http://davidwalsh.name/javascript-shorthand-if-else-examples</link> <description>Legendary scribbles about JavaScript, HTML5, AJAX, PHP, CSS, and ∞.</description> <lastBuildDate>Wed, 23 May 2012 04:02:29 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>By: Bryan De Asis</title><link>http://davidwalsh.name/javascript-shorthand-if-else-examples#comment-32194</link> <dc:creator>Bryan De Asis</dc:creator> <pubDate>Tue, 15 May 2012 21:59:01 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/javascript-shorthand-if-else-examples/#comment-32194</guid> <description>This is another simple if condition.
&lt;code&gt;
$var = &quot;nothing&quot;;
(true) &amp;&amp; $var = &quot;true&quot;;
echo $var;
&lt;code&gt;
Meaning using &amp;&amp; you are expecting the return of the condition to be true; If the condition is false it will not substitute the new value.&lt;code&gt;
$var = &quot;nothing&quot;;
(false) &#124;&#124;  $var = &quot;false&quot;;
echo $var;
&lt;code&gt;
Using &#124;&#124; you are expecting the return of the condition to be false; If the condition is true it will not substitute the new value.Hope this helps on optimizing conditions. Just play with it and you will discover more. Cheers!</description> <content:encoded><![CDATA[<p>This is another simple if condition.<br
/> <code><br
/> $var = "nothing";<br
/> (true) &amp;&amp; $var = "true";<br
/> echo $var;<br
/> </code><code><br
/> Meaning using &amp;&amp; you are expecting the return of the condition to be true; If the condition is false it will not substitute the new value.</p><p></code><code><br
/> $var = "nothing";<br
/> (false) ||  $var = "false";<br
/> echo $var;<br
/> </code><code><br
/> Using || you are expecting the return of the condition to be false; If the condition is true it will not substitute the new value.</p><p>Hope this helps on optimizing conditions. Just play with it and you will discover more. Cheers!</code></p> ]]></content:encoded> </item> <item><title>By: PHP Shorthand Conditional Statement &#124; schoberg.net</title><link>http://davidwalsh.name/javascript-shorthand-if-else-examples#comment-31980</link> <dc:creator>PHP Shorthand Conditional Statement &#124; schoberg.net</dc:creator> <pubDate>Wed, 02 May 2012 00:44:29 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/javascript-shorthand-if-else-examples/#comment-31980</guid> <description>[...] another quick hit from my php snippets. You can see a review of a lot of ways to do this on David Walsh&#8217;s post on the subject. However, I wanted to write it as short as possible to be used within pages. I use this a lot to [...]</description> <content:encoded><![CDATA[<p>[...] another quick hit from my php snippets. You can see a review of a lot of ways to do this on David Walsh&#8217;s post on the subject. However, I wanted to write it as short as possible to be used within pages. I use this a lot to [...]</p> ]]></content:encoded> </item> <item><title>By: Jamie</title><link>http://davidwalsh.name/javascript-shorthand-if-else-examples#comment-30720</link> <dc:creator>Jamie</dc:creator> <pubDate>Fri, 02 Mar 2012 17:25:45 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/javascript-shorthand-if-else-examples/#comment-30720</guid> <description>I&#039;ve been referring back to this post a lot, thanks! In working with a lot of javascript lately, I realized the shorthand for conditional logic is pretty much identical. So there is another statement you could add to this list- An &#039;if&#039; statement with no else can be written like this without the curly braces:&lt;code&gt;if ($myVar) echo &quot;$myVar is true&quot;;&lt;/code&gt;</description> <content:encoded><![CDATA[<p>I&#8217;ve been referring back to this post a lot, thanks! In working with a lot of javascript lately, I realized the shorthand for conditional logic is pretty much identical. So there is another statement you could add to this list- An &#8216;if&#8217; statement with no else can be written like this without the curly braces:</p><p><code>if ($myVar) echo "$myVar is true";</code></p> ]]></content:encoded> </item> <item><title>By: Jesse</title><link>http://davidwalsh.name/javascript-shorthand-if-else-examples#comment-28532</link> <dc:creator>Jesse</dc:creator> <pubDate>Fri, 13 Jan 2012 19:22:43 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/javascript-shorthand-if-else-examples/#comment-28532</guid> <description>Hmm apparently you can&#039;t show php tags in the code tags. Anyway.. if you look at the source you can see it commented out or maybe David can fix it.</description> <content:encoded><![CDATA[<p>Hmm apparently you can&#8217;t show php tags in the code tags. Anyway.. if you look at the source you can see it commented out or maybe David can fix it.</p> ]]></content:encoded> </item> <item><title>By: Jesse</title><link>http://davidwalsh.name/javascript-shorthand-if-else-examples#comment-28531</link> <dc:creator>Jesse</dc:creator> <pubDate>Fri, 13 Jan 2012 19:20:14 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/javascript-shorthand-if-else-examples/#comment-28531</guid> <description>Thought I would include this extreme shorthand example that I use all the time based off this:&lt;code&gt;
Tall enough to ride?
&lt;/code&gt;</description> <content:encoded><![CDATA[<p>Thought I would include this extreme shorthand example that I use all the time based off this:</p><p><code><br
/> Tall enough to ride?<br
/> </code></p> ]]></content:encoded> </item> <item><title>By: Ian.J.Gough</title><link>http://davidwalsh.name/javascript-shorthand-if-else-examples#comment-28486</link> <dc:creator>Ian.J.Gough</dc:creator> <pubDate>Mon, 09 Jan 2012 09:43:58 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/javascript-shorthand-if-else-examples/#comment-28486</guid> <description>Nice work thanks for sharing i&#039;ve re-wrote a script of mine and it&#039;s lot smaller now.
Many thanks and great site glad you got it back,
Ian
&lt;code&gt;
$title =  (!empty($tags[&#039;title&#039;]) ? $SpGr.$tags[&#039;title&#039;] : $SpRe.&#039;No title found&#039;).$SpCl;
&lt;/code&gt;</description> <content:encoded><![CDATA[<p>Nice work thanks for sharing i&#8217;ve re-wrote a script of mine and it&#8217;s lot smaller now.<br
/> Many thanks and great site glad you got it back,<br
/> Ian<br
/> <code><br
/> $title =  (!empty($tags['title']) ? $SpGr.$tags['title'] : $SpRe.'No title found').$SpCl;<br
/> </code></p> ]]></content:encoded> </item> <item><title>By: paul</title><link>http://davidwalsh.name/javascript-shorthand-if-else-examples#comment-27931</link> <dc:creator>paul</dc:creator> <pubDate>Thu, 15 Dec 2011 00:51:58 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/javascript-shorthand-if-else-examples/#comment-27931</guid> <description>Hi, I have this code:$r = myfunction($param) ;
return $r ? $r : anotherfunction();I want to short it, but I can&#039;t call myfunction() twice. Is any chance to short it?</description> <content:encoded><![CDATA[<p>Hi, I have this code:</p><p>$r = myfunction($param) ;<br
/> return $r ? $r : anotherfunction();</p><p>I want to short it, but I can&#8217;t call myfunction() twice. Is any chance to short it?</p> ]]></content:encoded> </item> <item><title>By: kevin</title><link>http://davidwalsh.name/javascript-shorthand-if-else-examples#comment-27259</link> <dc:creator>kevin</dc:creator> <pubDate>Sat, 15 Oct 2011 14:04:25 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/javascript-shorthand-if-else-examples/#comment-27259</guid> <description>great article. its easy to go a little nuts with shorthand conditionals given this knowledge :)</description> <content:encoded><![CDATA[<p>great article. its easy to go a little nuts with shorthand conditionals given this knowledge :)</p> ]]></content:encoded> </item> <item><title>By: TitoChhabra</title><link>http://davidwalsh.name/javascript-shorthand-if-else-examples#comment-27039</link> <dc:creator>TitoChhabra</dc:creator> <pubDate>Thu, 29 Sep 2011 16:27:26 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/javascript-shorthand-if-else-examples/#comment-27039</guid> <description>Hello Everyone,
‘If… Else’ statement is used to perform different action for different decision. Conditional (relational operator) statements are used to perform different action on basis of different decision. So we can say that ‘If…Else’ statement generally used with conditional statement.............. for more details please check out this link....
http://mindstick.com/Articles/a3394e30-37b0-45e9-9e5d-8beffd1ba7dc/?If%E2%80%A6Else%20Statement%20in%20PHPthanks !!!!!!</description> <content:encoded><![CDATA[<p>Hello Everyone,<br
/> ‘If… Else’ statement is used to perform different action for different decision. Conditional (relational operator) statements are used to perform different action on basis of different decision. So we can say that ‘If…Else’ statement generally used with conditional statement&#8230;&#8230;&#8230;&#8230;.. for more details please check out this link&#8230;.<br
/> <a
href="http://mindstick.com/Articles/a3394e30-37b0-45e9-9e5d-8beffd1ba7dc/?If%E2%80%A6Else%20Statement%20in%20PHP" rel="nofollow">http://mindstick.com/Articles/a3394e30-37b0-45e9-9e5d-8beffd1ba7dc/?If%E2%80%A6Else%20Statement%20in%20PHP</a></p><p>thanks !!!!!!</p> ]]></content:encoded> </item> <item><title>By: Blair Nichols</title><link>http://davidwalsh.name/javascript-shorthand-if-else-examples#comment-26980</link> <dc:creator>Blair Nichols</dc:creator> <pubDate>Sun, 25 Sep 2011 16:22:48 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/javascript-shorthand-if-else-examples/#comment-26980</guid> <description>Every time I get a little bit confused with conditional shorthand I seem to search and find this article I should bookmark it now as I always find it most helpful! Thanks David!</description> <content:encoded><![CDATA[<p>Every time I get a little bit confused with conditional shorthand I seem to search and find this article I should bookmark it now as I always find it most helpful! Thanks David!</p> ]]></content:encoded> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 3/7 queries in 0.008 seconds using disk: basic
Object Caching 805/805 objects using disk: basic

Served from: davidwalsh.name @ 2012-05-23 04:18:21 -->
