<?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>Tutorial Melayu &#187; belajar php melayu</title>
	<atom:link href="http://www.tutorialmelayu.com/tag/belajar-php-melayu/feed" rel="self" type="application/rss+xml" />
	<link>http://www.tutorialmelayu.com</link>
	<description></description>
	<lastBuildDate>Sun, 06 Nov 2011 12:38:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>if else &amp; ternary conditionals</title>
		<link>http://www.tutorialmelayu.com/web-programming/php/if-else-ternary-conditionals</link>
		<comments>http://www.tutorialmelayu.com/web-programming/php/if-else-ternary-conditionals#comments</comments>
		<pubDate>Sun, 08 Feb 2009 09:00:20 +0000</pubDate>
		<dc:creator>mdpai</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[belajar php melayu]]></category>
		<category><![CDATA[if else]]></category>
		<category><![CDATA[ternary operator]]></category>

		<guid isPermaLink="false">http://www.tutorialmelayu.com/?p=58</guid>
		<description><![CDATA[Kod di bawah bermaksud, jika condition true, buat statement1, jika false buat statement2. if &#40;condition&#41; &#123; statement1; &#125; else &#123; statement2; &#125; Mari kita lihat contoh sebenar di dalam PHP; &#60;?php if &#40;date&#40;&#34;G&#34;&#41; &#60; 12&#41; &#123; echo 'Selamat Pagi'; &#125; else &#123; echo 'Selamat Petang'; &#125; ?&#62; Namun, statement if else ini boleh disingkatkan lagi [...]]]></description>
			<content:encoded><![CDATA[<p>Kod di bawah bermaksud, jika condition true, buat statement1, jika false buat statement2. </p>
<p><span id="more-58"></span></p>

<div class="wp_codebox"><table><tr id="p585"><td class="code" id="p58code5"><pre class="php" style="font-family:monospace;"><span style="color: #e8ed97;">if</span> <span style="color: #eeeeee;">&#40;</span>condition<span style="color: #eeeeee;">&#41;</span> <span style="color: #eeeeee;">&#123;</span>
   statement1<span style="color: #eeeeee;">;</span>
<span style="color: #eeeeee;">&#125;</span> <span style="color: #e8ed97;">else</span> <span style="color: #eeeeee;">&#123;</span>
   statement2<span style="color: #eeeeee;">;</span>
<span style="color: #eeeeee;">&#125;</span></pre></td></tr></table></div>

<p>Mari kita lihat contoh sebenar di dalam PHP;</p>

<div class="wp_codebox"><table><tr id="p586"><td class="code" id="p58code6"><pre class="php" style="font-family:monospace;"><span style="color: #dfc484; font-weight: bold;">&lt;?php</span>
<span style="color: #e8ed97;">if</span> <span style="color: #eeeeee;">&#40;</span><span style="color: #dfc484;">date</span><span style="color: #eeeeee;">&#40;</span><span style="color: #ff8400;">&quot;G&quot;</span><span style="color: #eeeeee;">&#41;</span> <span style="color: #eeeeee;">&lt;</span> <span style="color: #ff8400;">12</span><span style="color: #eeeeee;">&#41;</span> <span style="color: #eeeeee;">&#123;</span>
<span style="color: #e8ed97;">echo</span> <span style="color: #ff8400;">'Selamat Pagi'</span><span style="color: #eeeeee;">;</span>
<span style="color: #eeeeee;">&#125;</span> <span style="color: #e8ed97;">else</span> <span style="color: #eeeeee;">&#123;</span>
<span style="color: #e8ed97;">echo</span> <span style="color: #ff8400;">'Selamat Petang'</span><span style="color: #eeeeee;">;</span>
<span style="color: #eeeeee;">&#125;</span>
<span style="color: #eeeeee; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Namun, statement if else ini boleh disingkatkan lagi dengan menggunakan operator ternary. Ternary Conditionals (menggunakan operator ternary) adalah salah satu cara untuk menjimatkan masa anda menulis code PHP. Strukturnya yang kelihatan <del datetime="2009-02-08T05:19:14+00:00">susah</del> pelik untuk difahami menyebabkan ianya tidak popular dikalangan programmer.<br />
Contoh di atas boleh ditulis semula dengan;</p>

<div class="wp_codebox"><table><tr id="p587"><td class="code" id="p58code7"><pre class="php" style="font-family:monospace;"><span style="color: #dfc484; font-weight: bold;">&lt;?php</span>
<span style="color: #e8ed97;">echo</span> <span style="color: #eeeeee;">&#40;</span><span style="color: #dfc484;">date</span><span style="color: #eeeeee;">&#40;</span><span style="color: #ff8400;">&quot;G&quot;</span><span style="color: #eeeeee;">&#41;</span> <span style="color: #eeeeee;">&lt;</span> <span style="color: #ff8400;">12</span><span style="color: #eeeeee;">&#41;</span> ? <span style="color: #ff8400;">'Selamat Pagi'</span> <span style="color: #eeeeee;">:</span> <span style="color: #ff8400;">'Selamat Petang'</span><span style="color: #eeeeee;">;</span>
<span style="color: #eeeeee; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>atau</p>

<div class="wp_codebox"><table><tr id="p588"><td class="code" id="p58code8"><pre class="php" style="font-family:monospace;"><span style="color: #dfc484; font-weight: bold;">&lt;?php</span>
<span style="color: #dfc484;">$greeting</span> <span style="color: #eeeeee;">=</span> <span style="color: #eeeeee;">&#40;</span><span style="color: #dfc484;">date</span><span style="color: #eeeeee;">&#40;</span><span style="color: #ff8400;">&quot;G&quot;</span><span style="color: #eeeeee;">&#41;</span> <span style="color: #eeeeee;">&lt;</span> <span style="color: #ff8400;">12</span><span style="color: #eeeeee;">&#41;</span> ? <span style="color: #ff8400;">'Selamat Pagi'</span> <span style="color: #eeeeee;">:</span> <span style="color: #ff8400;">'Selamat Petang'</span><span style="color: #eeeeee;">;</span>
<span style="color: #e8ed97;">echo</span> <span style="color: #dfc484;">$greeting</span><span style="color: #eeeeee;">;</span>
<span style="color: #eeeeee; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><a href="http://www.tutorialmelayu.com/wp-content/uploads/2009/02/800px-php-n_logosvg2.png"><img src="http://www.tutorialmelayu.com/wp-content/uploads/2009/02/800px-php-n_logosvg2.png" alt="800px-php-n_logosvg2" title="800px-php-n_logosvg2" width="256" height="134" class="alignnone size-full wp-image-74" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tutorialmelayu.com/web-programming/php/if-else-ternary-conditionals/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Concatenation : gabung string atau variable</title>
		<link>http://www.tutorialmelayu.com/web-programming/php/concatenation-gabung-string-atau-variable</link>
		<comments>http://www.tutorialmelayu.com/web-programming/php/concatenation-gabung-string-atau-variable#comments</comments>
		<pubDate>Sun, 08 Feb 2009 08:46:19 +0000</pubDate>
		<dc:creator>mdpai</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[belajar php melayu]]></category>
		<category><![CDATA[concatenation]]></category>
		<category><![CDATA[gabung string]]></category>
		<category><![CDATA[gabung variable]]></category>

		<guid isPermaLink="false">http://www.tutorialmelayu.com/?p=63</guid>
		<description><![CDATA[Concatenation digunakan untuk menggabungkan antara dua string, atau antara dua variable, atau antara string dan variable. Untuk concatenation ini, kita gunakan &#8220;.&#8221; Contoh concatenation antara 2 string; &#60;?php echo &#34;Nama saya &#34; . &#34;mdpai&#34;; ?&#62; Contoh concatenation antara 2 variable; &#60;?php $intro = &#34;nama saya &#34;; $nama = &#34;mdpai&#34;; echo $intro . $nama; ?&#62; Contoh [...]]]></description>
			<content:encoded><![CDATA[<p>Concatenation digunakan untuk menggabungkan antara dua string, atau antara dua variable, atau antara string dan variable. Untuk concatenation ini, kita gunakan &#8220;.&#8221;</p>
<p><span id="more-63"></span></p>
<p>Contoh concatenation antara 2 string;</p>

<div class="wp_codebox"><table><tr id="p6313"><td class="code" id="p63code13"><pre class="php" style="font-family:monospace;"><span style="color: #dfc484; font-weight: bold;">&lt;?php</span>
   <span style="color: #e8ed97;">echo</span> <span style="color: #ff8400;">&quot;Nama saya &quot;</span> <span style="color: #eeeeee;">.</span> <span style="color: #ff8400;">&quot;mdpai&quot;</span><span style="color: #eeeeee;">;</span>
<span style="color: #eeeeee; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Contoh concatenation antara 2 variable;</p>

<div class="wp_codebox"><table><tr id="p6314"><td class="code" id="p63code14"><pre class="php" style="font-family:monospace;"><span style="color: #dfc484; font-weight: bold;">&lt;?php</span>
   <span style="color: #dfc484;">$intro</span> <span style="color: #eeeeee;">=</span> <span style="color: #ff8400;">&quot;nama saya &quot;</span><span style="color: #eeeeee;">;</span>
   <span style="color: #dfc484;">$nama</span> <span style="color: #eeeeee;">=</span> <span style="color: #ff8400;">&quot;mdpai&quot;</span><span style="color: #eeeeee;">;</span>
   <span style="color: #e8ed97;">echo</span> <span style="color: #dfc484;">$intro</span> <span style="color: #eeeeee;">.</span> <span style="color: #dfc484;">$nama</span><span style="color: #eeeeee;">;</span>
<span style="color: #eeeeee; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Contoh concatenation antara string dan variable;</p>

<div class="wp_codebox"><table><tr id="p6315"><td class="code" id="p63code15"><pre class="php" style="font-family:monospace;"><span style="color: #dfc484; font-weight: bold;">&lt;?php</span>
   <span style="color: #dfc484;">$nama</span> <span style="color: #eeeeee;">=</span> <span style="color: #ff8400;">&quot;mdpai&quot;</span><span style="color: #eeeeee;">;</span>
   <span style="color: #e8ed97;">echo</span> <span style="color: #ff8400;">&quot;Nama saya &quot;</span><span style="color: #eeeeee;">.</span> <span style="color: #dfc484;">$nama</span><span style="color: #eeeeee;">;</span>
<span style="color: #eeeeee; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Output untuk ketiga-tiga contoh ini adalah</p>

<div class="wp_codebox"><table><tr id="p6316"><td class="code" id="p63code16"><pre class="html" style="font-family:monospace;">Nama saya mdpai</pre></td></tr></table></div>

<p><a href="http://www.tutorialmelayu.com/wp-content/uploads/2009/02/800px-php-n_logosvg.png"><img src="http://www.tutorialmelayu.com/wp-content/uploads/2009/02/800px-php-n_logosvg.png" alt="800px-php-n_logosvg" title="800px-php-n_logosvg" width="256" height="134" class="alignnone size-full wp-image-68" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tutorialmelayu.com/web-programming/php/concatenation-gabung-string-atau-variable/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>php string</title>
		<link>http://www.tutorialmelayu.com/web-programming/php/php-string</link>
		<comments>http://www.tutorialmelayu.com/web-programming/php/php-string#comments</comments>
		<pubDate>Sun, 08 Feb 2009 06:31:16 +0000</pubDate>
		<dc:creator>mdpai</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[belajar php melayu]]></category>
		<category><![CDATA[php string]]></category>
		<category><![CDATA[tutorial melayu php]]></category>

		<guid isPermaLink="false">http://www.tutorialmelayu.com/?p=60</guid>
		<description><![CDATA[Di dalam post variable yang lepas, kita telah menggunakan function echo untuk output sesuatu kepada browser. Kali ini pula, kita akan memahami dengan lebih lanjut tentang php string. Kita boleh gunakan string untuk output terus kepada browser atau untuk disimpan di dalam variable. Output untuk kedua-duanya adalah sama. Lihat contoh; &#60;?php $my_string = 'Tutorial PHP [...]]]></description>
			<content:encoded><![CDATA[<p>Di dalam <a href="http://www.tutorialmelayu.com/web-programming/php/hello-world-2">post variable</a> yang lepas, kita telah menggunakan function echo untuk output sesuatu kepada browser. Kali ini pula, kita akan memahami dengan lebih lanjut tentang php string. Kita boleh gunakan string untuk output terus kepada browser atau untuk disimpan di dalam variable. Output untuk kedua-duanya adalah sama. Lihat contoh;</p>
<p><span id="more-60"></span></p>

<div class="wp_codebox"><table><tr id="p6020"><td class="code" id="p60code20"><pre class="php" style="font-family:monospace;"><span style="color: #dfc484; font-weight: bold;">&lt;?php</span>
   <span style="color: #dfc484;">$my_string</span> <span style="color: #eeeeee;">=</span> <span style="color: #ff8400;">'Tutorial PHP dalam bahasa melayu -www.tutorialmelayu.com'</span><span style="color: #eeeeee;">;</span>
   <span style="color: #e8ed97;">echo</span> <span style="color: #dfc484;">$my_string</span><span style="color: #eeeeee;">;</span>
   <span style="color: #e8ed97;">echo</span> <span style="color: #ff8400;">'Tutorial PHP dalam bahasa melayu -www.tutorialmelayu.com'</span><span style="color: #eeeeee;">;</span>
<span style="color: #eeeeee; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Jika anda perasan, dalam post yang lepas saya menggunakan &#8220;string saya&#8221;, manakala kali ini saya menggunakan &#8216;string saya&#8217;. Kedua-dua cara ini betul tetapi ada sedikit perbezaan yang mana boleh membuatkan anda pening kepala jika tidak digunakan dengan betul.</p>

<div class="wp_codebox"><table><tr id="p6021"><td class="code" id="p60code21"><pre class="php" style="font-family:monospace;"><span style="color: #dfc484; font-weight: bold;">&lt;?php</span>
   <span style="color: #dfc484;">$bahasa</span> <span style="color: #eeeeee;">=</span> <span style="color: #ff8400;">&quot;melayu&quot;</span><span style="color: #eeeeee;">;</span>
   <span style="color: #e8ed97;">echo</span> <span style="color: #ff8400;">&quot;Tutorial PHP dalam bahasa <span style="color: #dfc484; font-weight: bold;">$bahasa</span> -www.tutorialmelayu.com&lt;br&gt;&quot;</span><span style="color: #eeeeee;">;</span>
   <span style="color: #e8ed97;">echo</span> <span style="color: #ff8400;">'Tutorial PHP dalam bahasa $bahasa -www.tutorialmelayu.com&lt;br&gt;'</span><span style="color: #eeeeee;">;</span>
<span style="color: #eeeeee; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Output untuk kod di atas</p>

<div class="wp_codebox"><table><tr id="p6022"><td class="code" id="p60code22"><pre class="html" style="font-family:monospace;">   Tutorial PHP dalam bahasa melayu -www.tutorialmelayu.com
   Tutorial PHP dalam bahasa $bahasa -www.tutorialmelayu.com</pre></td></tr></table></div>

<blockquote><p>Variable tidak akan digantikan dengan nilainya jika digunakan di dalam &#8216;  &#8216; !!</p></blockquote>
<p><a href="http://www.tutorialmelayu.com/wp-content/uploads/2009/02/800px-php-n_logosvg1.png"><img src="http://www.tutorialmelayu.com/wp-content/uploads/2009/02/800px-php-n_logosvg1.png" alt="800px-php-n_logosvg1" title="800px-php-n_logosvg1" width="256" height="134" class="alignnone size-full wp-image-70" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tutorialmelayu.com/web-programming/php/php-string/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

