<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>php if else short - TsupamaN.com</title>
	<atom:link href="https://www.tsupaman.com/tag/php-if-else-short/feed" rel="self" type="application/rss+xml" />
	<link>https://www.tsupaman.com/tag/php-if-else-short</link>
	<description>ทำเว็บไซต์ด้วย Wordpress</description>
	<lastBuildDate>Wed, 12 Feb 2014 03:05:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>
	<item>
		<title>PHP : การใช้เงื่อนไข if else แบบย่อ</title>
		<link>https://www.tsupaman.com/2014/02/php-%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b9%83%e0%b8%8a%e0%b9%89%e0%b9%80%e0%b8%87%e0%b8%b7%e0%b9%88%e0%b8%ad%e0%b8%99%e0%b9%84%e0%b8%82-if-else-%e0%b9%81%e0%b8%9a%e0%b8%9a%e0%b8%a2%e0%b9%88%e0%b8%ad</link>
		
		<dc:creator><![CDATA[TsupamaN]]></dc:creator>
		<pubDate>Sat, 22 Feb 2014 02:58:52 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[if else ย่อ]]></category>
		<category><![CDATA[if else แบบย่อ]]></category>
		<category><![CDATA[php if else]]></category>
		<category><![CDATA[php if else short]]></category>
		<category><![CDATA[php if else แบบย่อ]]></category>
		<guid isPermaLink="false">https://www.tsupaman.com/?p=642</guid>

					<description><![CDATA[<p>PHP : การใช้เงื่อนไข if else แบบย่อ โปรแกรมเมอร์ หลายๆ คนมักใช้ if else ในการจัดการกับทางแยกของปัญหาว่า หากเกิดสิ่งเหล่านี้ขึ้นโปรแกรมจะไปในทางไหน ซึ่งรูปแบบของ if else ปกติคือ if (เงื่อนไข){   statement }else if(เงื่อนไข){ statement }else{ statement } ซึ่งหากมีเงื่อนไขแค่นิดเดียว แต่เรากลับต้องเขียน if else เต็มรูปแบบ มันก็อาจทำให้โค้ดของเรารกหูรกตา อาจเขียนในรูปแบบย่อได้ดังนี้ echo $x == 0 ? "OK" : "Sorry"; โดยมีความหมายว่า ถ้าตัวแปร x มีค่าเท่ากับ 0 ผลลัพธ์เท่ากับ OK ถ้าไม่ใช่ก็เท่ากับ Sorry แค่นี้แหละครับ สั้นๆ ง่ายๆ ลองเอาไปใช้กันดู [&#8230;]</p>
<p>The post <a href="https://www.tsupaman.com/2014/02/php-%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b9%83%e0%b8%8a%e0%b9%89%e0%b9%80%e0%b8%87%e0%b8%b7%e0%b9%88%e0%b8%ad%e0%b8%99%e0%b9%84%e0%b8%82-if-else-%e0%b9%81%e0%b8%9a%e0%b8%9a%e0%b8%a2%e0%b9%88%e0%b8%ad">PHP : การใช้เงื่อนไข if else แบบย่อ</a> appeared first on <a href="https://www.tsupaman.com">TsupamaN.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div id="stcpDiv">
<h3>PHP : การใช้เงื่อนไข <strong>if else แบบย่อ</strong></h3>
<p>โปรแกรมเมอร์ หลายๆ คนมักใช้ if else ในการจัดการกับทางแยกของปัญหาว่า หากเกิดสิ่งเหล่านี้ขึ้นโปรแกรมจะไปในทางไหน ซึ่งรูปแบบของ if else ปกติคือ</p>
<pre><code>if (เงื่อนไข){
      statement
}else if(เงื่อนไข){
      statement
}else{
     statement
}</code></pre>
<p>ซึ่งหากมีเงื่อนไขแค่นิดเดียว แต่เรากลับต้องเขียน if else เต็มรูปแบบ มันก็อาจทำให้โค้ดของเรารกหูรกตา อาจเขียนในรูปแบบย่อได้ดังนี้</p>
<pre title="">echo $x == 0 ? "OK" : "Sorry";</pre>
<p>โดยมีความหมายว่า ถ้าตัวแปร x มีค่าเท่ากับ 0 ผลลัพธ์เท่ากับ OK ถ้าไม่ใช่ก็เท่ากับ Sorry</p>
<p>แค่นี้แหละครับ สั้นๆ ง่ายๆ ลองเอาไปใช้กันดู สำหรับการเขียน <strong>if else แบบย่อ</strong> นี้ควรระวังเรื่อง syntax ให้ดีนะครับ error มาจะหาลำบาก เพราะโค้ดบรรทัดเดียว อาจลายตาได้</p>
</div>
<p>The post <a href="https://www.tsupaman.com/2014/02/php-%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b9%83%e0%b8%8a%e0%b9%89%e0%b9%80%e0%b8%87%e0%b8%b7%e0%b9%88%e0%b8%ad%e0%b8%99%e0%b9%84%e0%b8%82-if-else-%e0%b9%81%e0%b8%9a%e0%b8%9a%e0%b8%a2%e0%b9%88%e0%b8%ad">PHP : การใช้เงื่อนไข if else แบบย่อ</a> appeared first on <a href="https://www.tsupaman.com">TsupamaN.com</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
