<?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>MaggsWeb:7 &#187; PHP</title>
	<atom:link href="http://www.maggsweb.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.maggsweb.com</link>
	<description>www.maggsweb.com</description>
	<lastBuildDate>Fri, 03 Feb 2012 22:50:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>PHP page load time</title>
		<link>http://www.maggsweb.com/php/php-page-load-time/</link>
		<comments>http://www.maggsweb.com/php/php-page-load-time/#comments</comments>
		<pubDate>Mon, 31 Oct 2011 09:20:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://www.maggsweb.com/?p=1348</guid>
		<description><![CDATA[Display the page load time&#8230; ?View Code PHP&#60;?php &#160; $startTime = microtime&#40;TRUE&#41;; $endTime = round&#40;microtime&#40;TRUE&#41; - $startTime, 3&#41; . &#34; seconds&#34;; &#160; ?&#62; This function is used on the ADMIN sections of my own sites : http://www.maggsweb.co.uk]]></description>
			<content:encoded><![CDATA[<p>Display the page load time&#8230;</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1348code2'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p13482"><td class="code" id="p1348code2"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000088;">$startTime</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/microtime" onclick="pageTracker._trackPageview('/outgoing/www.php.net/microtime?referer=');"><span style="color: #990000;">microtime</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$endTime</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/round" onclick="pageTracker._trackPageview('/outgoing/www.php.net/round?referer=');"><span style="color: #990000;">round</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/microtime" onclick="pageTracker._trackPageview('/outgoing/www.php.net/microtime?referer=');"><span style="color: #990000;">microtime</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$startTime</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; seconds&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>This function is used on the ADMIN sections of my own sites : <a href="http://www.maggsweb.co.uk" title="MaggsWeb" onclick="pageTracker._trackPageview('/outgoing/www.maggsweb.co.uk?referer=');">http://www.maggsweb.co.uk</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.maggsweb.com/php/php-page-load-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP date dashes to slashes</title>
		<link>http://www.maggsweb.com/php/php-date-dashes-to-slashes/</link>
		<comments>http://www.maggsweb.com/php/php-date-dashes-to-slashes/#comments</comments>
		<pubDate>Mon, 31 Oct 2011 09:19:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[function]]></category>

		<guid isPermaLink="false">http://www.maggsweb.com/?p=1346</guid>
		<description><![CDATA[Converting a date format, simply and quickly. ?View Code PHP&#60;?php &#160; function reverseDate&#40;$dateIn&#41;&#123; list&#40;$year,$month,$day&#41; = explode&#40;'-',$dateIn&#41;; return &#34;$month/$day/$year&#34;; &#125; &#160; ?&#62; This function is used on my own site : http://www.maggsweb.co.uk]]></description>
			<content:encoded><![CDATA[<p>Converting a date format, simply and quickly.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1346code4'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p13464"><td class="code" id="p1346code4"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">function</span> reverseDate<span style="color: #009900;">&#40;</span><span style="color: #000088;">$dateIn</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
       <a href="http://www.php.net/list" onclick="pageTracker._trackPageview('/outgoing/www.php.net/list?referer=');"><span style="color: #990000;">list</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$year</span><span style="color: #339933;">,</span><span style="color: #000088;">$month</span><span style="color: #339933;">,</span><span style="color: #000088;">$day</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/explode" onclick="pageTracker._trackPageview('/outgoing/www.php.net/explode?referer=');"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'-'</span><span style="color: #339933;">,</span><span style="color: #000088;">$dateIn</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
       <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$month</span>/<span style="color: #006699; font-weight: bold;">$day</span>/<span style="color: #006699; font-weight: bold;">$year</span>&quot;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>This function is used on my own site : <a href="http://www.maggsweb.co.uk" title="MaggsWeb" onclick="pageTracker._trackPageview('/outgoing/www.maggsweb.co.uk?referer=');">http://www.maggsweb.co.uk</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.maggsweb.com/php/php-date-dashes-to-slashes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Display tweets from RSS with twitter style links</title>
		<link>http://www.maggsweb.com/php/display-tweets-from-rss-with-twitter-style-links/</link>
		<comments>http://www.maggsweb.com/php/display-tweets-from-rss-with-twitter-style-links/#comments</comments>
		<pubDate>Sun, 30 Oct 2011 11:30:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.maggsweb.com/?p=1343</guid>
		<description><![CDATA[Based on an original post here: http://www.farinspace.com/twitter-feed-website-integration/ but modified lisghtly to mimic Twitter. ?View Code PHP&#160; &#60;?php //http://www.farinspace.com/twitter-feed-website-integration/ function linkify_tweet&#40;$v&#41; &#123; $v = ' ' . $v; &#160; $v = preg_replace&#40;'/(^&#124;\s)@(\w+)/', '&#60;a href=&#34;http://www.twitter.com/\2&#34;&#62;\1@\2&#60;/a&#62;', $v&#41;; $v = preg_replace&#40;'/(^&#124;\s)#(\w+)/', '&#60;a href=&#34;http://search.twitter.com/search?q=\2&#34;&#62;\1#\2&#60;/a&#62;', $v&#41;; &#160; $v = preg_replace&#40;&#34;#(^&#124;[\n ])([\w]+?://[\w]+[^ \&#34;\n\r\t&#60;]*)#ise&#34;, &#34;'\\1&#60;a href=\&#34;\\2\&#34; &#62;\\2&#60;/a&#62;'&#34;, $v&#41;; $v = preg_replace&#40;&#34;#(^&#124;[\n ])((www&#124;ftp)\.[^ \&#34;\t\n\r&#60;]*)#ise&#34;, [...]]]></description>
			<content:encoded><![CDATA[<p>Based on an original post here:</p>
<p>http://www.farinspace.com/twitter-feed-website-integration/</p>
<p>but modified lisghtly to mimic Twitter.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1343code6'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p13436"><td class="code" id="p1343code6"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">//http://www.farinspace.com/twitter-feed-website-integration/</span>
<span style="color: #000000; font-weight: bold;">function</span> linkify_tweet<span style="color: #009900;">&#40;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$v</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">' '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$v</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$v</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/preg_replace" onclick="pageTracker._trackPageview('/outgoing/www.php.net/preg_replace?referer=');"><span style="color: #990000;">preg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/(^|\s)@(\w+)/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;a href=&quot;http://www.twitter.com/\2&quot;&gt;\1@\2&lt;/a&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$v</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/preg_replace" onclick="pageTracker._trackPageview('/outgoing/www.php.net/preg_replace?referer=');"><span style="color: #990000;">preg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/(^|\s)#(\w+)/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;a href=&quot;http://search.twitter.com/search?q=\2&quot;&gt;\1#\2&lt;/a&gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$v</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/preg_replace" onclick="pageTracker._trackPageview('/outgoing/www.php.net/preg_replace?referer=');"><span style="color: #990000;">preg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;#(^|[<span style="color: #000099; font-weight: bold;">\n</span> ])([\w]+?://[\w]+[^ <span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\t</span>&lt;]*)#ise&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;'<span style="color: #000099; font-weight: bold;">\\</span>1&lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\\</span>2<span style="color: #000099; font-weight: bold;">\&quot;</span> &gt;<span style="color: #000099; font-weight: bold;">\\</span>2&lt;/a&gt;'&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$v</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/preg_replace" onclick="pageTracker._trackPageview('/outgoing/www.php.net/preg_replace?referer=');"><span style="color: #990000;">preg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;#(^|[<span style="color: #000099; font-weight: bold;">\n</span> ])((www|ftp)\.[^ <span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\t</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span>&lt;]*)#ise&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;'<span style="color: #000099; font-weight: bold;">\\</span>1&lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span>http://<span style="color: #000099; font-weight: bold;">\\</span>2<span style="color: #000099; font-weight: bold;">\&quot;</span> &gt;<span style="color: #000099; font-weight: bold;">\\</span>2&lt;/a&gt;'&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$v</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/preg_replace" onclick="pageTracker._trackPageview('/outgoing/www.php.net/preg_replace?referer=');"><span style="color: #990000;">preg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;#(^|[<span style="color: #000099; font-weight: bold;">\n</span> ])([a-z0-9&amp;\-_\.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>1&lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span>mailto:<span style="color: #000099; font-weight: bold;">\\</span>2@<span style="color: #000099; font-weight: bold;">\\</span>3<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #000099; font-weight: bold;">\\</span>2@<span style="color: #000099; font-weight: bold;">\\</span>3&lt;/a&gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <a href="http://www.php.net/trim" onclick="pageTracker._trackPageview('/outgoing/www.php.net/trim?referer=');"><span style="color: #990000;">trim</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.maggsweb.com/php/display-tweets-from-rss-with-twitter-style-links/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>display filesize</title>
		<link>http://www.maggsweb.com/php/display-filesize/</link>
		<comments>http://www.maggsweb.com/php/display-filesize/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 10:03:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[filesize]]></category>
		<category><![CDATA[function]]></category>

		<guid isPermaLink="false">http://www.maggsweb.com/?p=1266</guid>
		<description><![CDATA[Nicely displaying the filesize, using bytes, megabytes, etc.. ?View Code PHP&#60;?php &#160; function dispFileSize&#40;$file&#41;&#123; $type = array&#40;&#34;b&#34;, &#34;KB&#34;, &#34;MB&#34;, &#34;GB&#34;, &#34;TB&#34;, &#34;PB&#34;&#41;; $pos = 0; $size = filesize&#40;$file&#41;; while &#40;$size &#62;= 1024&#41; &#123; $size /= 1024; $pos++; &#125; return round&#40;$size,1&#41;.&#34; &#34;.$type&#91;$pos&#93;; &#125; ?&#62;]]></description>
			<content:encoded><![CDATA[<p>Nicely displaying the filesize, using bytes, megabytes, etc..</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1266code8'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p12668"><td class="code" id="p1266code8"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> dispFileSize<span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$type</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array" onclick="pageTracker._trackPageview('/outgoing/www.php.net/array?referer=');"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;b&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;KB&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;MB&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;GB&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;TB&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;PB&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$pos</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$size</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/filesize" onclick="pageTracker._trackPageview('/outgoing/www.php.net/filesize?referer=');"><span style="color: #990000;">filesize</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$size</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">1024</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
     <span style="color: #000088;">$size</span> <span style="color: #339933;">/=</span> <span style="color: #cc66cc;">1024</span><span style="color: #339933;">;</span> 
     <span style="color: #000088;">$pos</span><span style="color: #339933;">++;</span> 
   <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> <a href="http://www.php.net/round" onclick="pageTracker._trackPageview('/outgoing/www.php.net/round?referer=');"><span style="color: #990000;">round</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$size</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$type</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$pos</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.maggsweb.com/php/display-filesize/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>prevent caching of files</title>
		<link>http://www.maggsweb.com/php/prevent-caching-of-files/</link>
		<comments>http://www.maggsweb.com/php/prevent-caching-of-files/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 09:59:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[cache]]></category>

		<guid isPermaLink="false">http://www.maggsweb.com/?p=1259</guid>
		<description><![CDATA[Version them in their with their timestamp. This way, when they change, the link will change and the browser will reload the sitemap&#8230; Otherwise it will be fine to be cached as it wont have changed. ?View Code HTML&#160; &#60;link type='text/css' src='/styles/styles.css?v=&#60;?=filemtime(DOC_ROOT.&#34;/styles_ie.css&#34;)?&#62;' /&#62;]]></description>
			<content:encoded><![CDATA[<p>Version them in their
<link> with their timestamp.  This way, when they change, the link will change and the browser will reload the sitemap&#8230;   Otherwise it will be fine to be cached as it wont have changed.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1259code10'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p125910"><td class="code" id="p1259code10"><pre class="html" style="font-family:monospace;">&nbsp;
&lt;link type='text/css' src='/styles/styles.css?v=&lt;?=filemtime(DOC_ROOT.&quot;/styles_ie.css&quot;)?&gt;' /&gt;</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.maggsweb.com/php/prevent-caching-of-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>resubmit sitemap automatically using curl</title>
		<link>http://www.maggsweb.com/php/resubmit-sitemap-automatically-using-curl/</link>
		<comments>http://www.maggsweb.com/php/resubmit-sitemap-automatically-using-curl/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 09:52:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[SEO]]></category>

		<guid isPermaLink="false">http://www.maggsweb.com/?p=1254</guid>
		<description><![CDATA[How to resubmit generated sitemaps automatically (using cron) or on an event (like re-generation of the sitemap). ?View Code PHP&#60;?php pingSE&#40;urlencode&#40;$url&#41;,'google'&#41;; pingSE&#40;urlencode&#40;$url&#41;,'bing'&#41;; pingSE&#40;urlencode&#40;$url&#41;,'ask'&#41;; ?&#62; And the function goodiness&#8230;. ?View Code PHP&#60;?php &#160; function pingSE&#40;$sitemap,$service&#41;&#123; &#160; switch &#40;$service&#41; &#123; case 'bing': $ping = &#34;http://www.bing.com/webmaster/ping.aspx?siteMap=$sitemap&#34;; break; case 'ask': $ping = &#34;http://submissions.ask.com/ping?sitemap=$sitemap&#34;; break; case 'google': $ping = &#34;http://www.google.com/webmasters/tools/ping?sitemap=$sitemap&#34;; [...]]]></description>
			<content:encoded><![CDATA[<p>How to resubmit generated sitemaps automatically (using cron) or on an event (like re-generation of the sitemap).</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1254code13'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p125413"><td class="code" id="p1254code13"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
pingSE<span style="color: #009900;">&#40;</span><a href="http://www.php.net/urlencode" onclick="pageTracker._trackPageview('/outgoing/www.php.net/urlencode?referer=');"><span style="color: #990000;">urlencode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'google'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
pingSE<span style="color: #009900;">&#40;</span><a href="http://www.php.net/urlencode" onclick="pageTracker._trackPageview('/outgoing/www.php.net/urlencode?referer=');"><span style="color: #990000;">urlencode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'bing'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
pingSE<span style="color: #009900;">&#40;</span><a href="http://www.php.net/urlencode" onclick="pageTracker._trackPageview('/outgoing/www.php.net/urlencode?referer=');"><span style="color: #990000;">urlencode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'ask'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>And the function goodiness&#8230;.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1254code14'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p125414"><td class="code" id="p1254code14"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> pingSE<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sitemap</span><span style="color: #339933;">,</span><span style="color: #000088;">$service</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$service</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'bing'</span><span style="color: #339933;">:</span>
      <span style="color: #000088;">$ping</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://www.bing.com/webmaster/ping.aspx?siteMap=<span style="color: #006699; font-weight: bold;">$sitemap</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'ask'</span><span style="color: #339933;">:</span>
      <span style="color: #000088;">$ping</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://submissions.ask.com/ping?sitemap=<span style="color: #006699; font-weight: bold;">$sitemap</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'google'</span><span style="color: #339933;">:</span>
      <span style="color: #000088;">$ping</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://www.google.com/webmasters/tools/ping?sitemap=<span style="color: #006699; font-weight: bold;">$sitemap</span>&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">default</span><span style="color: #339933;">:</span>
      <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$curl_handle</span><span style="color: #339933;">=</span><a href="http://www.php.net/curl_init" onclick="pageTracker._trackPageview('/outgoing/www.php.net/curl_init?referer=');"><span style="color: #990000;">curl_init</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/curl_setopt" onclick="pageTracker._trackPageview('/outgoing/www.php.net/curl_setopt?referer=');"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_handle</span><span style="color: #339933;">,</span>CURLOPT_URL<span style="color: #339933;">,</span><span style="color: #000088;">$ping</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/curl_setopt" onclick="pageTracker._trackPageview('/outgoing/www.php.net/curl_setopt?referer=');"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_handle</span><span style="color: #339933;">,</span>CURLOPT_CONNECTTIMEOUT<span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/curl_setopt" onclick="pageTracker._trackPageview('/outgoing/www.php.net/curl_setopt?referer=');"><span style="color: #990000;">curl_setopt</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_handle</span><span style="color: #339933;">,</span>CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$run</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/curl_exec" onclick="pageTracker._trackPageview('/outgoing/www.php.net/curl_exec?referer=');"><span style="color: #990000;">curl_exec</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_handle</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #000088;">$response</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/curl_getinfo" onclick="pageTracker._trackPageview('/outgoing/www.php.net/curl_getinfo?referer=');"><span style="color: #990000;">curl_getinfo</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_handle</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<a href="http://www.php.net/curl_close" onclick="pageTracker._trackPageview('/outgoing/www.php.net/curl_close?referer=');"><span style="color: #990000;">curl_close</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$curl_handle</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$response</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'http_code'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">200</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>       
       <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Sitemap successfully submitted&quot;</span><span style="color: #339933;">;</span>       
   <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.maggsweb.com/php/resubmit-sitemap-automatically-using-curl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Date format switching for MySQL</title>
		<link>http://www.maggsweb.com/php/date-format-switch-mysql/</link>
		<comments>http://www.maggsweb.com/php/date-format-switch-mysql/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 09:48:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[function]]></category>

		<guid isPermaLink="false">http://www.maggsweb.com/?p=1249</guid>
		<description><![CDATA[Easy way of switching between mysql and &#8220;normal&#8221; dates (english, not american)&#8230; ?View Code PHP&#60;?php function flipdate&#40;$dt, $seperator_in = '-', $seperator_out = '-'&#41; &#123; return implode&#40;$seperator_out, array_reverse&#40;explode&#40;$seperator_in, $dt&#41;&#41;&#41;; &#125; ?&#62;]]></description>
			<content:encoded><![CDATA[<p>Easy way of switching between mysql and &#8220;normal&#8221; dates (english, not american)&#8230;</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1249code16'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p124916"><td class="code" id="p1249code16"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">function</span> flipdate<span style="color: #009900;">&#40;</span><span style="color: #000088;">$dt</span><span style="color: #339933;">,</span> <span style="color: #000088;">$seperator_in</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'-'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$seperator_out</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'-'</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
<span style="color: #b1b100;">return</span> <a href="http://www.php.net/implode" onclick="pageTracker._trackPageview('/outgoing/www.php.net/implode?referer=');"><span style="color: #990000;">implode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$seperator_out</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array_reverse" onclick="pageTracker._trackPageview('/outgoing/www.php.net/array_reverse?referer=');"><span style="color: #990000;">array_reverse</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/explode" onclick="pageTracker._trackPageview('/outgoing/www.php.net/explode?referer=');"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$seperator_in</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dt</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.maggsweb.com/php/date-format-switch-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Show Bytes</title>
		<link>http://www.maggsweb.com/php/show-bytes/</link>
		<comments>http://www.maggsweb.com/php/show-bytes/#comments</comments>
		<pubDate>Thu, 28 Apr 2011 13:13:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[function]]></category>

		<guid isPermaLink="false">http://www.maggsweb.com/?p=820</guid>
		<description><![CDATA[Haven&#8217;t actually used this one, but it does work&#8230; ?View Code PHP&#60;?php function size_format&#40; $bytes, $decimals = null &#41; &#123; $quant = array&#40; // ========================= Origin ==== 'TB' =&#62; 1099511627776, // pow( 1024, 4) 'GB' =&#62; 1073741824, // pow( 1024, 3) 'MB' =&#62; 1048576, // pow( 1024, 2) 'kB' =&#62; 1024, // pow( 1024, 1) [...]]]></description>
			<content:encoded><![CDATA[<p>Haven&#8217;t actually used this one, but it does work&#8230;</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p820code18'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p82018"><td class="code" id="p820code18"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">function</span> size_format<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$bytes</span><span style="color: #339933;">,</span> <span style="color: #000088;">$decimals</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$quant</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array" onclick="pageTracker._trackPageview('/outgoing/www.php.net/array?referer=');"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span>
		<span style="color: #666666; font-style: italic;">// ========================= Origin ====</span>
		<span style="color: #0000ff;">'TB'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1099511627776</span><span style="color: #339933;">,</span>  <span style="color: #666666; font-style: italic;">// pow( 1024, 4)</span>
		<span style="color: #0000ff;">'GB'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1073741824</span><span style="color: #339933;">,</span>     <span style="color: #666666; font-style: italic;">// pow( 1024, 3)</span>
		<span style="color: #0000ff;">'MB'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1048576</span><span style="color: #339933;">,</span>        <span style="color: #666666; font-style: italic;">// pow( 1024, 2)</span>
		<span style="color: #0000ff;">'kB'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1024</span><span style="color: #339933;">,</span>           <span style="color: #666666; font-style: italic;">// pow( 1024, 1)</span>
		<span style="color: #0000ff;">'B '</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span>              <span style="color: #666666; font-style: italic;">// pow( 1024, 0)</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$quant</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$unit</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$mag</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/doubleval" onclick="pageTracker._trackPageview('/outgoing/www.php.net/doubleval?referer=');"><span style="color: #990000;">doubleval</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$bytes</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;=</span> <span style="color: #000088;">$mag</span> <span style="color: #009900;">&#41;</span>
			<span style="color: #b1b100;">return</span> number_format_i18n<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$bytes</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$mag</span><span style="color: #339933;">,</span> <span style="color: #000088;">$decimals</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$unit</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.maggsweb.com/php/show-bytes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP file extension</title>
		<link>http://www.maggsweb.com/php/php-file-extension/</link>
		<comments>http://www.maggsweb.com/php/php-file-extension/#comments</comments>
		<pubDate>Thu, 28 Apr 2011 13:11:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.maggsweb.com/?p=789</guid>
		<description><![CDATA[Never used &#8216;pathinfo&#8217; before, but I can see its uses.. Personally, I would explode on the &#8216;/&#8217;, then on the &#8216;.&#8217;, etc&#8230;]]></description>
			<content:encoded><![CDATA[<p>Never used &#8216;pathinfo&#8217; before, but I can see its uses..<br />
Personally, I would explode on the &#8216;/&#8217;, then on the &#8216;.&#8217;, etc&#8230;</p>
<p><?php<br />
    //PATH INFO RETURNS: DIRNAME, BASENAME, EXTENSION, FILENAME FROM A PATH<br />
    $details = pathinfo('videos/file.flv');</p>
<p>    //EXTRACT EXTENSION FROM THE DETAILS ARRAY CREATED BY PATH INFO<br />
    $extension =  $details['extension'];</p>
<p>    //PRINT THE EXTENSION OF THE FILE<br />
    echo($extension);<br />
?></p>
]]></content:encoded>
			<wfw:commentRss>http://www.maggsweb.com/php/php-file-extension/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dump variables</title>
		<link>http://www.maggsweb.com/php/dumpr-variables/</link>
		<comments>http://www.maggsweb.com/php/dumpr-variables/#comments</comments>
		<pubDate>Thu, 28 Apr 2011 13:09:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[function]]></category>

		<guid isPermaLink="false">http://www.maggsweb.com/?p=926</guid>
		<description><![CDATA[This is my extension of an existing function, adatped for my requirements. ?View Code PHP&#60;?php function dumpr&#40;$VARIABLE_NAME, $DATA&#41;&#123; if &#40;is_object&#40;$DATA&#41;&#41; &#123; $data = &#40;array&#41; $DATA; &#125; elseif &#40;is_array&#40;$DATA&#41;&#41; &#123; $data = $DATA; &#125; else &#123; $data = strval&#40;$DATA&#41;; &#125; $output = &#34;&#60;table class='dumpr'&#62;&#34;; $output .= &#34;&#60;head&#62;&#34;; $output .= &#34;&#60;tr&#62;&#34;; $output .= &#34;&#60;th colspan='2'&#62;&#34; . $VARIABLE_NAME [...]]]></description>
			<content:encoded><![CDATA[<p>This is my extension of an existing function, adatped for my requirements.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?" onclick="pageTracker._trackPageview('/outgoing/www.ericbess.com/ericblog/2008/03/03/wp-codebox/_examples?referer=');"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p926code20'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p92620"><td class="code" id="p926code20"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">function</span> dumpr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$VARIABLE_NAME</span><span style="color: #339933;">,</span> <span style="color: #000088;">$DATA</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/is_object" onclick="pageTracker._trackPageview('/outgoing/www.php.net/is_object?referer=');"><span style="color: #990000;">is_object</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$DATA</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/array" onclick="pageTracker._trackPageview('/outgoing/www.php.net/array?referer=');"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$DATA</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/is_array" onclick="pageTracker._trackPageview('/outgoing/www.php.net/is_array?referer=');"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$DATA</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$DATA</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/strval" onclick="pageTracker._trackPageview('/outgoing/www.php.net/strval?referer=');"><span style="color: #990000;">strval</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$DATA</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;table class='dumpr'&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;head&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;tr&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;th colspan='2'&gt;&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$VARIABLE_NAME</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;/th&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;/tr&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;/head&gt;&lt;body&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/is_array" onclick="pageTracker._trackPageview('/outgoing/www.php.net/is_array?referer=');"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #666666; font-style: italic;">//$value = dumpr($key, $value);</span>
            <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;tr&gt;&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;td&gt;<span style="color: #006699; font-weight: bold;">$key</span>&lt;/td&gt;&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;td&gt;<span style="color: #006699; font-weight: bold;">$value</span>&lt;/td&gt;&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;/tr&gt;&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;tr&gt;&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;td colspan=2&gt;<span style="color: #006699; font-weight: bold;">$data</span>&lt;/td&gt;&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;/tr&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;/body&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;/table&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$output</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Use like this:<br />
echo dumpr(&#8216;NAME&#8217;,$var);<br />
echo dumpr(&#8216;SESSION&#8217;,$_SESSION);<br />
etc..</p>
<p>Displays a nicely formatted table, with values of a string / array / object clearly displayed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maggsweb.com/php/dumpr-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

