<?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>Vim, Cygwin, MySQL &#38; Zsh Tips &#187; PHP</title>
	<atom:link href="http://zzapper.co.uk/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://zzapper.co.uk</link>
	<description></description>
	<lastBuildDate>Tue, 13 Jul 2010 22:45:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Parsing HTML with preg_match</title>
		<link>http://zzapper.co.uk/parsing-html-with-preg_match/</link>
		<comments>http://zzapper.co.uk/parsing-html-with-preg_match/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 20:46:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Coding Tips]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[regex]]></category>

		<guid isPermaLink="false">http://zzapper.co.uk/?p=97</guid>
		<description><![CDATA[preg_match_all(&#8216;#&#60;b>.+?&#60;/b>#i&#8217;, $html, $matches); // ? means non-greedy and is absolutely critical $match[1], $match[2] contain the results Non greedy stops the match gobbling everything between the first bold tag and the very last. I&#8217;ve never quite understood why greedy is the default behavior of RegExp (Regular Expressions) but I guess there&#8217;s a good reason for it. [...]]]></description>
			<content:encoded><![CDATA[<p>preg_match_all(&#8216;#&lt;b>.+?&lt;/b>#i&#8217;, $html, $matches);<br />
// ? means non-greedy and is absolutely critical</p>
<p>$match[1], $match[2] contain the results</p>
<p>Non greedy stops the match gobbling everything between the first bold tag and the very last. I&#8217;ve never quite understood why greedy is the default behavior of RegExp (Regular Expressions) but I guess there&#8217;s a good reason for it.</p>
<p>PHP also has the very useful <a href="http://www.php.net/manual/en/function.strip-tags.php">strip_tags</a> function.</p>
]]></content:encoded>
			<wfw:commentRss>http://zzapper.co.uk/parsing-html-with-preg_match/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hereis Document for PHP: Great for Generation of HTML</title>
		<link>http://zzapper.co.uk/hereis-document-for-php-great-for-generation-of-html/</link>
		<comments>http://zzapper.co.uk/hereis-document-for-php-great-for-generation-of-html/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 18:28:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[hereis document]]></category>

		<guid isPermaLink="false">http://zzapper.co.uk/?p=47</guid>
		<description><![CDATA[I see so much ugly tangled php/javascript/html/css code which could be tidied up with the PHP Hereis Document]]></description>
			<content:encoded><![CDATA[<p><code>The great thing about hereis documents is that in most cases you don't have to backslash quotes, your "html" thus retains its visibility<br />
echo &lt;&lt;&lt;__HTML__</code><br />
&lt;li&gt;&lt;a href=&#8221;$pressdir$file&#8221;&gt;$file&lt;/a&gt;<br />
__HTML__;</p>
<p>$html.= &lt;&lt;&lt;__HTML__<br />
&lt;li&gt;&lt;a href=&#8221;$pressdir$file&#8221;&gt;$file&lt;/a&gt;<br />
__HTML__;</p>
<p>return &lt;&lt;&lt;__HTML__<br />
&lt;li&gt;&lt;a href=&#8221;$pressdir$file&#8221;&gt;$file&lt;/a&gt;<br />
__HTML__;</p>
<p>it can also cope with arrays if you use the following syntax ${my_array['postcode']}</p>
<p>return &lt;&lt;&lt;__HTML__<br />
&lt;li&gt;&lt;a href=&#8221;$multimap_url${my_array['postcode']}&#8221;&gt;${my_array['postcode']}&lt;/a&gt;<br />
__HTML__;</p>
<p>I see so much ugly tangled php/javascript/html/css code which could be tidied up with the PHP Hereis Document</p>
]]></content:encoded>
			<wfw:commentRss>http://zzapper.co.uk/hereis-document-for-php-great-for-generation-of-html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Design a Database Driven PHP Page</title>
		<link>http://zzapper.co.uk/how-to-design-a-database-driven-php-page/</link>
		<comments>http://zzapper.co.uk/how-to-design-a-database-driven-php-page/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 13:30:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://zzapper.co.uk/?p=40</guid>
		<description><![CDATA[Design a Database Driven PHP Page Many PHP pages turn into a mess because the PHP code is embedded into the HTML and. Over time this gets more and more tangled as the requirements change. What is required is to make all the necessary database queries and all the manipulation of the data BEFORE you [...]]]></description>
			<content:encoded><![CDATA[<p>Design a Database Driven PHP Page</p>
<p>Many PHP pages turn into a mess because the PHP code is embedded into the HTML and. Over time this gets more and more tangled as the requirements change.</p>
<p>What is required is to make all the necessary database queries and all the manipulation of the data BEFORE you reach the first  tag.</p>
<p>All that should appear in the HTML are the various php echos to output the dynamic parts of the page.</p>
<p>So here is the structure of a PHP page<br />
<table border=1>
<tr>
<td width=90%>
query database
</td>
</tr>
<tr>
<td width=90%>
insert data from queries into php arrays (hashs)
</td>
</tr>
<tr>
<td width=90%>
General functions
</td>
</tr>
<tr>
<td width=90%>
Main section call functions, which manipulate the data to get that required by the dynamic web page
</td>
</tr>
<tr>
<td width=90%>
html section
</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://zzapper.co.uk/how-to-design-a-database-driven-php-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
