<?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>Linux Ask! &#187; PHP</title>
	<atom:link href="http://www.linuxask.com/topics/programming/php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linuxask.com</link>
	<description>Linux Ask! is a Q &#38; A web site specific for Linux related questions such as how to use common Linux commands.</description>
	<lastBuildDate>Tue, 05 May 2015 07:15:40 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>How to upgrade a single package in Ubuntu</title>
		<link>http://www.linuxask.com/questions/how-to-upgrade-a-single-package-in-ubuntu</link>
		<comments>http://www.linuxask.com/questions/how-to-upgrade-a-single-package-in-ubuntu#comments</comments>
		<pubDate>Sun, 27 May 2012 09:45:01 +0000</pubDate>
		<dc:creator><![CDATA[Linux Ask!]]></dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[apc]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=3822</guid>
		<description><![CDATA[How to upgrade a single package in Ubuntu Answer: To upgrade a single package, you just need to install the package again, e.g. # sudo apt-get install nginx<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/upgrade-packages-in-ubuntu" rel="bookmark" title="Upgrade Packages in Ubuntu">Upgrade Packages in Ubuntu </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-upgrade-ubuntu-to-newer-version" rel="bookmark" title="How to upgrade Ubuntu to newer version">How to upgrade Ubuntu to newer version </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-upgrade-an-installed-rpm-package" rel="bookmark" title="How to upgrade an installed RPM package">How to upgrade an installed RPM package </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>How to upgrade a single package in Ubuntu</p>
<p><strong>Answer:</strong></p>
<p>To upgrade a single package, you just need to install the package again, e.g.</p>
<p><code># sudo apt-get install nginx</code></p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/upgrade-packages-in-ubuntu" rel="bookmark" title="Upgrade Packages in Ubuntu">Upgrade Packages in Ubuntu </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-upgrade-ubuntu-to-newer-version" rel="bookmark" title="How to upgrade Ubuntu to newer version">How to upgrade Ubuntu to newer version </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-upgrade-an-installed-rpm-package" rel="bookmark" title="How to upgrade an installed RPM package">How to upgrade an installed RPM package </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/how-to-upgrade-a-single-package-in-ubuntu/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello World in different scripting languages</title>
		<link>http://www.linuxask.com/questions/hello-world-in-different-scripting-languages</link>
		<comments>http://www.linuxask.com/questions/hello-world-in-different-scripting-languages#comments</comments>
		<pubDate>Wed, 28 Sep 2011 10:44:11 +0000</pubDate>
		<dc:creator><![CDATA[Linux Ask!]]></dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=3528</guid>
		<description><![CDATA[Print to standard output in different scripting languages Answer: To print a string of "Hello World" to the standard output in different scripting languages 1. Perl print "Hello, World!"; 2. Python print('Hello, World!') 3. PHP echo "Hello, World!"; 4. Ruby puts "Hello, World!"<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/multi-line-string-in-ruby" rel="bookmark" title="Multi-line string in Ruby">Multi-line string in Ruby </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-perform-syntax-check-for-python-program" rel="bookmark" title="How to perform syntax check for Python program">How to perform syntax check for Python program </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-modify-a-single-character-in-a-string-in-python" rel="bookmark" title="How to modify a single character in a string in Python?">How to modify a single character in a string in Python? </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Print to standard output in different scripting languages</p>
<p><strong>Answer:</strong></p>
<p>To print a string of "<strong>Hello World</strong>" to the standard output in different scripting languages</p>
<p><strong>1. Perl<br />
</strong><br />
<code>print "Hello, World!";</code></p>
<p><strong>2. Python<br />
</strong><br />
<code>print('Hello, World!')</code></p>
<p><strong>3. PHP<br />
</strong><br />
<code>echo "Hello, World!";</code></p>
<p><strong>4. Ruby<br />
</strong><br />
<code>puts "Hello, World!"</code></p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/multi-line-string-in-ruby" rel="bookmark" title="Multi-line string in Ruby">Multi-line string in Ruby </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-perform-syntax-check-for-python-program" rel="bookmark" title="How to perform syntax check for Python program">How to perform syntax check for Python program </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-modify-a-single-character-in-a-string-in-python" rel="bookmark" title="How to modify a single character in a string in Python?">How to modify a single character in a string in Python? </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/hello-world-in-different-scripting-languages/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to remove object from array inside foreach loop?</title>
		<link>http://www.linuxask.com/questions/how-to-remove-object-from-array-inside-foreach-loop</link>
		<comments>http://www.linuxask.com/questions/how-to-remove-object-from-array-inside-foreach-loop#comments</comments>
		<pubDate>Mon, 12 Sep 2011 07:16:34 +0000</pubDate>
		<dc:creator><![CDATA[Linux Ask!]]></dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=3478</guid>
		<description><![CDATA[How to remove object from array inside foreach loop? Answer: In PHP, to remove object (e.g. with the key = foo in the following example) from array inside foreach loop, you can try: &#60;?php foreach($array as $key=> $value) { if ($key == "foo") { unset($array[$key]); } }<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/convert-array-to-object-in-php" rel="bookmark" title="Convert array to object in PHP">Convert array to object in PHP </a></li>
<li><a href="http://www.linuxask.com/questions/clone-an-object-in-php" rel="bookmark" title="Clone an object in PHP">Clone an object in PHP </a></li>
<li><a href="http://www.linuxask.com/questions/create-an-array-containing-a-range-of-elements-in-php" rel="bookmark" title="Create an array containing a range of elements in PHP">Create an array containing a range of elements in PHP </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>How to remove object from array inside foreach loop?</p>
<p><strong>Answer:</strong></p>
<p>In PHP, to remove object (e.g. with the key = <strong>foo </strong>in the following example) from array inside foreach loop, you can try:</p>
<pre><code>&lt;?php

foreach($array as $key=> $value) {
    if ($key == "foo") {
        unset($array[$key]);
    }
}</code></pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/convert-array-to-object-in-php" rel="bookmark" title="Convert array to object in PHP">Convert array to object in PHP </a></li>
<li><a href="http://www.linuxask.com/questions/clone-an-object-in-php" rel="bookmark" title="Clone an object in PHP">Clone an object in PHP </a></li>
<li><a href="http://www.linuxask.com/questions/create-an-array-containing-a-range-of-elements-in-php" rel="bookmark" title="Create an array containing a range of elements in PHP">Create an array containing a range of elements in PHP </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/how-to-remove-object-from-array-inside-foreach-loop/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Validate IP address in PHP</title>
		<link>http://www.linuxask.com/questions/validate-ip-address-in-php</link>
		<comments>http://www.linuxask.com/questions/validate-ip-address-in-php#comments</comments>
		<pubDate>Fri, 05 Aug 2011 15:39:53 +0000</pubDate>
		<dc:creator><![CDATA[Linux Ask!]]></dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=3228</guid>
		<description><![CDATA[Validate IP address in PHP Answer: If you are using PHP 5.2 or above (in fact, at the moment of writing, you should use at least PHP 5.3+), you can use the following easy method: if(filter_var($ip, FILTER_VALIDATE_IP)) { // Valid IP } else { // Invalid IP }<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/validate-email-address-using-php" rel="bookmark" title="Validate email address using PHP">Validate email address using PHP </a></li>
<li><a href="http://www.linuxask.com/questions/what-is-the-difference-between-ip-address-0-0-0-0-and-127-0-0-1" rel="bookmark" title="What is the difference between ip address 0.0.0.0 and 127.0.0.1?">What is the difference between ip address 0.0.0.0 and 127.0.0.1? </a></li>
<li><a href="http://www.linuxask.com/questions/block-a-remote-ip-address-using-iptables" rel="bookmark" title="Block a remote IP Address using iptables">Block a remote IP Address using iptables </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Validate IP address in PHP</p>
<p><strong>Answer:</strong></p>
<p>If you are using <strong>PHP 5.2</strong> or above (in fact, at the moment of writing, you should use at least PHP 5.3+), you can use the following easy method:</p>
<pre><code>if(filter_var($ip, FILTER_VALIDATE_IP)) 
{
  // Valid IP
}
else 
{
  // Invalid IP
}</code></pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/validate-email-address-using-php" rel="bookmark" title="Validate email address using PHP">Validate email address using PHP </a></li>
<li><a href="http://www.linuxask.com/questions/what-is-the-difference-between-ip-address-0-0-0-0-and-127-0-0-1" rel="bookmark" title="What is the difference between ip address 0.0.0.0 and 127.0.0.1?">What is the difference between ip address 0.0.0.0 and 127.0.0.1? </a></li>
<li><a href="http://www.linuxask.com/questions/block-a-remote-ip-address-using-iptables" rel="bookmark" title="Block a remote IP Address using iptables">Block a remote IP Address using iptables </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/validate-ip-address-in-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get the current PHP include path&#8217;s setting</title>
		<link>http://www.linuxask.com/questions/get-the-current-php-include-paths-setting</link>
		<comments>http://www.linuxask.com/questions/get-the-current-php-include-paths-setting#comments</comments>
		<pubDate>Mon, 01 Aug 2011 15:24:50 +0000</pubDate>
		<dc:creator><![CDATA[Linux Ask!]]></dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=3224</guid>
		<description><![CDATA[Get the current PHP include path's setting Answer: To get the current PHP include path's setting, you can use the function get_include_path E.g. echo get_include_path(); Usually it is used with the set_include_path for adding extra path to the existing include_path, E.g. set_include_path(get_include_path() . PATH_SEPARATOR . "/data/path");<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/what-is-the-difference-between-include-and-require-in-php" rel="bookmark" title="What is the difference between include() and require() in PHP?">What is the difference between include() and require() in PHP? </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-execute-prorgam-in-the-current-directory" rel="bookmark" title="How to execute prorgam in the current directory">How to execute prorgam in the current directory </a></li>
<li><a href="http://www.linuxask.com/questions/list-the-size-of-sub-directories-in-the-current-directory" rel="bookmark" title="List the size of sub directories in the current directory">List the size of sub directories in the current directory </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Get the current PHP include path's setting</p>
<p><strong>Answer:</strong></p>
<p>To get the current PHP include path's setting, you can use the function <strong>get_include_path </strong></p>
<p>E.g.</p>
<pre><code>echo get_include_path();</code></pre>
<p>Usually it is used with the <strong>set_include_path</strong> for adding extra path to the existing include_path,</p>
<p>E.g.</p>
<pre><code>set_include_path(get_include_path() . PATH_SEPARATOR . "/data/path");</code></pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/what-is-the-difference-between-include-and-require-in-php" rel="bookmark" title="What is the difference between include() and require() in PHP?">What is the difference between include() and require() in PHP? </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-execute-prorgam-in-the-current-directory" rel="bookmark" title="How to execute prorgam in the current directory">How to execute prorgam in the current directory </a></li>
<li><a href="http://www.linuxask.com/questions/list-the-size-of-sub-directories-in-the-current-directory" rel="bookmark" title="List the size of sub directories in the current directory">List the size of sub directories in the current directory </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/get-the-current-php-include-paths-setting/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check the amount of memory used by PHP</title>
		<link>http://www.linuxask.com/questions/check-the-amount-of-memory-used-by-php</link>
		<comments>http://www.linuxask.com/questions/check-the-amount-of-memory-used-by-php#comments</comments>
		<pubDate>Sat, 23 Jul 2011 15:15:43 +0000</pubDate>
		<dc:creator><![CDATA[Linux Ask!]]></dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=3220</guid>
		<description><![CDATA[Check the amount of memory used by PHP Answer: To check the amount of memory used by PHP process, use the function - memory_get_usage E.g. // Returns the amount of memory, in bytes, that's currently being allocated to your PHP script. echo memory_get_usage();<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/how-to-check-the-amount-of-free-space-in-a-server" rel="bookmark" title="How to check the amount of free space in a server?">How to check the amount of free space in a server? </a></li>
<li><a href="http://www.linuxask.com/questions/how-do-i-check-memory-information-in-linux" rel="bookmark" title="How do I check memory information in Linux?">How do I check memory information in Linux? </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-check-current-memory-usage" rel="bookmark" title="How to check current memory usage?">How to check current memory usage? </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Check the amount of memory used by PHP</p>
<p><strong>Answer:</strong></p>
<p>To check the  amount of memory used by <strong>PHP </strong>process, use the function - <strong>memory_get_usage </strong></p>
<p>E.g.</p>
<pre><code>// Returns the amount of memory, in bytes, that's currently being allocated to your PHP script.
echo memory_get_usage(); </code></pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/how-to-check-the-amount-of-free-space-in-a-server" rel="bookmark" title="How to check the amount of free space in a server?">How to check the amount of free space in a server? </a></li>
<li><a href="http://www.linuxask.com/questions/how-do-i-check-memory-information-in-linux" rel="bookmark" title="How do I check memory information in Linux?">How do I check memory information in Linux? </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-check-current-memory-usage" rel="bookmark" title="How to check current memory usage?">How to check current memory usage? </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/check-the-amount-of-memory-used-by-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Turn off magic_quotes_gpc in PHP</title>
		<link>http://www.linuxask.com/questions/turn-off-magic_quotes_gpc-in-php</link>
		<comments>http://www.linuxask.com/questions/turn-off-magic_quotes_gpc-in-php#comments</comments>
		<pubDate>Sat, 09 Jul 2011 08:00:35 +0000</pubDate>
		<dc:creator><![CDATA[Linux Ask!]]></dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=2091</guid>
		<description><![CDATA[Turn off magic_quotes_gpc in PHP Answer: magic_quotes_gpc is a legacy PHP function that no longer be supported in PHP 6.0. So you should disable them to make sure your application not break in the future version of PHP. To disable it, edit the php.ini vi /etc/php.ini Locate and set magic_quotes_gpc = off; Remember to restart <a href='http://www.linuxask.com/questions/turn-off-magic_quotes_gpc-in-php' class='excerpt-more'>[...]</a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/turn-on-register_globals-in-php" rel="bookmark" title="Turn on register_globals in PHP">Turn on register_globals in PHP </a></li>
<li><a href="http://www.linuxask.com/questions/what-is-the-phps-short_open_tag" rel="bookmark" title="What is the PHP&#8217;s short_open_tag">What is the PHP&#8217;s short_open_tag </a></li>
<li><a href="http://www.linuxask.com/questions/set-the-maximum-execution-time-in-php" rel="bookmark" title="Set the maximum execution time in PHP">Set the maximum execution time in PHP </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Turn off magic_quotes_gpc in PHP</p>
<p><strong>Answer:</strong></p>
<p><strong>magic_quotes_gpc </strong>is a legacy PHP function that no longer be supported in PHP 6.0. So you should disable them to make sure your application not break in the future version of PHP.</p>
<p>To disable it, edit the <strong>php.ini</strong></p>
<p><code>vi /etc/php.ini</code></p>
<p>Locate and set</p>
<pre><code>magic_quotes_gpc = off;</code></pre>
<p>Remember to restart web server such as Apache if needed.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/turn-on-register_globals-in-php" rel="bookmark" title="Turn on register_globals in PHP">Turn on register_globals in PHP </a></li>
<li><a href="http://www.linuxask.com/questions/what-is-the-phps-short_open_tag" rel="bookmark" title="What is the PHP&#8217;s short_open_tag">What is the PHP&#8217;s short_open_tag </a></li>
<li><a href="http://www.linuxask.com/questions/set-the-maximum-execution-time-in-php" rel="bookmark" title="Set the maximum execution time in PHP">Set the maximum execution time in PHP </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/turn-off-magic_quotes_gpc-in-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Validate email address using PHP</title>
		<link>http://www.linuxask.com/questions/validate-email-address-using-php</link>
		<comments>http://www.linuxask.com/questions/validate-email-address-using-php#comments</comments>
		<pubDate>Thu, 14 Apr 2011 15:47:29 +0000</pubDate>
		<dc:creator><![CDATA[Linux Ask!]]></dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=2911</guid>
		<description><![CDATA[Validate email address using PHP Answer: To validate an email address using PHP, you can use the code below. (It is from www.ilovejackdaniels.com/php/email-address-validation , it is not perfect, but better than most of the average solutions found in the Internet) &#60;?php function check_email_address($email) { // First, we check that there's one @ symbol, // and <a href='http://www.linuxask.com/questions/validate-email-address-using-php' class='excerpt-more'>[...]</a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/validate-ip-address-in-php" rel="bookmark" title="Validate IP address in PHP">Validate IP address in PHP </a></li>
<li><a href="http://www.linuxask.com/questions/show-the-domain-name-servers-for-a-domain" rel="bookmark" title="Show the Domain Name Servers for a domain">Show the Domain Name Servers for a domain </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-get-the-ip-address-assigned-to-eth0-by-a-single-command" rel="bookmark" title="How to get the IP address assigned to eth0 by a single command">How to get the IP address assigned to eth0 by a single command </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Validate email address using PHP</p>
<p><strong>Answer:</strong></p>
<p>To validate an email address using PHP, you can use the code below. (It is from <a href="http://www.ilovejackdaniels.com/php/email-address-validation">www.ilovejackdaniels.com/php/email-address-validation</a> , it is not perfect, but better than most of the average solutions found in the Internet)</p>
<pre><code>&lt;?php

function check_email_address($email) {
  // First, we check that there's one @ symbol, 
  // and that the lengths are right.
  if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
    // Email invalid because wrong number of characters 
    // in one section or wrong number of @ symbols.
    return false;
  }
  // Split it into sections to make life easier
  $email_array = explode("@", $email);
  $local_array = explode(".", $email_array[0]);
  for ($i = 0; $i < sizeof($local_array); $i++) {
    if
(!ereg("^(([A-Za-z0-9!#$%&#038;'*+/=?^_`{|}~-][A-Za-z0-9!#$%&#038;
↪'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$",
$local_array[$i])) {
      return false;
    }
  }
  // Check if domain is IP. If not, 
  // it should be valid domain name
  if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) {
    $domain_array = explode(".", $email_array[1]);
    if (sizeof($domain_array) < 2) {
        return false; // Not enough parts to domain
    }
    for ($i = 0; $i < sizeof($domain_array); $i++) {
      if
(!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|
↪([A-Za-z0-9]+))$",
$domain_array[$i])) {
        return false;
      }
    }
  }
  return true;
}
</code></pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/validate-ip-address-in-php" rel="bookmark" title="Validate IP address in PHP">Validate IP address in PHP </a></li>
<li><a href="http://www.linuxask.com/questions/show-the-domain-name-servers-for-a-domain" rel="bookmark" title="Show the Domain Name Servers for a domain">Show the Domain Name Servers for a domain </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-get-the-ip-address-assigned-to-eth0-by-a-single-command" rel="bookmark" title="How to get the IP address assigned to eth0 by a single command">How to get the IP address assigned to eth0 by a single command </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/validate-email-address-using-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sending a UTF-8 encoded CSV from PHP</title>
		<link>http://www.linuxask.com/questions/sending-a-utf-8-encoded-csv-from-php</link>
		<comments>http://www.linuxask.com/questions/sending-a-utf-8-encoded-csv-from-php#comments</comments>
		<pubDate>Tue, 22 Mar 2011 09:21:09 +0000</pubDate>
		<dc:creator><![CDATA[Linux Ask!]]></dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=2868</guid>
		<description><![CDATA[Sending a UTF8 encoded CSV from PHP Answer: It is easy to generate a CSV file using the fputcsv function. One of a very common problems is even the file is UTF-8 encoded, Microsoft Excel is still unable to identiy the file as UTF-8. To solve this, you need to add the UTF-8 BOM to <a href='http://www.linuxask.com/questions/sending-a-utf-8-encoded-csv-from-php' class='excerpt-more'>[...]</a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/convert-utf-16-encoded-file-to-utf-8" rel="bookmark" title="Convert UTF-16 encoded file to UTF-8">Convert UTF-16 encoded file to UTF-8 </a></li>
<li><a href="http://www.linuxask.com/questions/disable-sending-php-version-information-by-apachemod_php" rel="bookmark" title="Disable sending PHP version information by Apache/mod_php">Disable sending PHP version information by Apache/mod_php </a></li>
<li><a href="http://www.linuxask.com/questions/output-the-parsable-string-representation-of-a-variable-in-php" rel="bookmark" title="Output the parsable string representation of a variable in PHP">Output the parsable string representation of a variable in PHP </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Sending a UTF8 encoded CSV from PHP</p>
<p><strong>Answer:</strong></p>
<p>It is easy to generate a CSV file using the <strong><a href="http://php.net/manual/en/function.fputcsv.php">fputcsv </a></strong>function. One of a very common problems is even the file is UTF-8 encoded, Microsoft Excel is still unable to identiy the file as UTF-8.</p>
<p>To solve this, you need to add the <strong>UTF-8 BOM </strong>to the beginning of the file.</p>
<p>E.g.</p>
<pre><code>&lt;?php 

echo "\xEF\xBB\xBF" . $csvdata; // Assume $csvdata contains the CSV string you want to output
</code></pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/convert-utf-16-encoded-file-to-utf-8" rel="bookmark" title="Convert UTF-16 encoded file to UTF-8">Convert UTF-16 encoded file to UTF-8 </a></li>
<li><a href="http://www.linuxask.com/questions/disable-sending-php-version-information-by-apachemod_php" rel="bookmark" title="Disable sending PHP version information by Apache/mod_php">Disable sending PHP version information by Apache/mod_php </a></li>
<li><a href="http://www.linuxask.com/questions/output-the-parsable-string-representation-of-a-variable-in-php" rel="bookmark" title="Output the parsable string representation of a variable in PHP">Output the parsable string representation of a variable in PHP </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/sending-a-utf-8-encoded-csv-from-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Error control operator in PHP</title>
		<link>http://www.linuxask.com/questions/error-control-operator-in-php</link>
		<comments>http://www.linuxask.com/questions/error-control-operator-in-php#comments</comments>
		<pubDate>Fri, 18 Mar 2011 05:20:49 +0000</pubDate>
		<dc:creator><![CDATA[Linux Ask!]]></dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.linuxask.com/?p=2865</guid>
		<description><![CDATA[Error control operator in PHP Answer: The error control operator (the @) is useful to ignore any error messages that might be generated by PHP. E.g. &#60;?php $my_value = @$my_array[$key]; The above statement will not generate any warning even if the index $key doesn't exist.<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/fix-the-warning-of-remote-host-identification-has-changed-error-and-solution" rel="bookmark" title="Fix the warning of: Remote Host Identification Has Changed error and solution">Fix the warning of: Remote Host Identification Has Changed error and solution </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-repair-a-broken-mysql-replication" rel="bookmark" title="How to repair a broken MySQL replication?">How to repair a broken MySQL replication? </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-redirect-error-message-to-a-file" rel="bookmark" title="How to redirect error message to a file">How to redirect error message to a file </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Error control operator in PHP</p>
<p><strong>Answer:</strong></p>
<p>The error control operator (the <strong>@</strong>) is useful to ignore any error messages that might be generated by PHP.</p>
<p>E.g.</p>
<pre><code>&lt;?php

$my_value = @$my_array[$key];
</code></pre>
<p>The above statement will not generate any warning even if the index <strong>$key</strong> doesn't exist.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="http://www.linuxask.com/questions/fix-the-warning-of-remote-host-identification-has-changed-error-and-solution" rel="bookmark" title="Fix the warning of: Remote Host Identification Has Changed error and solution">Fix the warning of: Remote Host Identification Has Changed error and solution </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-repair-a-broken-mysql-replication" rel="bookmark" title="How to repair a broken MySQL replication?">How to repair a broken MySQL replication? </a></li>
<li><a href="http://www.linuxask.com/questions/how-to-redirect-error-message-to-a-file" rel="bookmark" title="How to redirect error message to a file">How to redirect error message to a file </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxask.com/questions/error-control-operator-in-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
