<?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"
	>

<channel>
	<title>Website Design Blog by DreamCo Design &#187; Web Programming</title>
	<atom:link href="http://www.dreamcodesign.com/blog/category/web-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dreamcodesign.com/blog</link>
	<description>Web Design 101</description>
	<pubDate>Mon, 24 Nov 2008 19:05:55 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Web Programming: Static vs. Dynamic</title>
		<link>http://www.dreamcodesign.com/blog/web-programming-static-vs-dynamic/</link>
		<comments>http://www.dreamcodesign.com/blog/web-programming-static-vs-dynamic/#comments</comments>
		<pubDate>Wed, 09 Jan 2008 17:16:44 +0000</pubDate>
		<dc:creator>Tanya</dc:creator>
		
		<category><![CDATA[Web Programming]]></category>

		<guid isPermaLink="false">http://www.dreamcodesign.com/blog/web-programming-static-vs-dynamic/</guid>
		<description><![CDATA[          In the wide world of web design there are so many different types of programming out there if I told you about each one it would fill up your head and leak out your ears. When is comes down to a website&#8217;s programming though there are two broad types of websites; static and dynamic. Deciding [...]]]></description>
			<content:encoded><![CDATA[<p>          In the wide world of web design there are so many different types of programming out there if I told you about each one it would fill up<img border="0" vspace="5" align="right" width="150" src="http://www.dreamcodesign.com/blog/images/2008/01/web-programming-wooly.jpg" hspace="5" height="190" /> your head and leak out your ears. When is comes down to a website&#8217;s programming though there are two broad types of websites; static and dynamic. Deciding which of these types would benefit you and/or your company more comes down to the differences in each.</p>
<p>          The definition of static is fixed; or unchanging. This is exactly what you get when you have a static website. A static site is one that is built completely in HTML. This means that it is built once and that is it. All the information and content on it says the same forever. That is, unless you know HTML coding and can go into the files to switch the content around. Most people who have websites built for them do not know how to do this. Also if you were to know how to change around you own content, there is the risk of you accidentally breaking the design of the site while you&#8217;re in there. This is not easily fixed by one that doesn&#8217;t know the coding. The last problem I see with static websites is that the website visitor doesn&#8217;t really get as much out of <img border="0" vspace="5" align="left" width="150" src="http://www.dreamcodesign.com/blog/images/2008/01/web-programming-matrix.jpg" hspace="5" height="113" />it. Static websites are basically a bunch of content/information provided in a webpage format. Although it seems as if a static website would be a pain to have and almost useless if you have content that needs to be changed; it does have some benefits. Developing a static website is fast because there isn&#8217;t anything really to it. It is cheap as well, cheap to develop and cheap to host which is great for someone on a lower budget.</p>
<p>          A dynamic website has a little more to it and is basically the exact opposite of a static website. With a dynamic <img border="0" vspace="5" align="right" width="150" src="http://www.dreamcodesign.com/blog/images/2008/01/web-programming-poor.jpg" hspace="5" height="225" />website the programmer builds you something usually referred to as an admin panel. This panel allows you to be able to go in and change around you content without having to mess with any of the actual files or coding of the site. It&#8217;s usually built so that it is very easy to understand. This panel can be programmed into the website so you can add or remove content, pictures, whatever you need. Although a dynamic website is the more useful of the two it is also more expensive because of all the extra programming that has to go into it. It also takes longer to develop because it has to be customized to do exactly what you need it to. In the long run though a dynamic website will be better for your business because it bring customers/visitors back. With content changing frequently they won&#8217;t be bored or have seen the same thing each time they visit. Also, adding new content to your site frequently will help with being found by the search engines.</p>
<p>          In the end, if you want to have a successful website you really should think about what kind of website suits you. This would be the most beneficial approach for any business owner. Deciding which is better; having a static website or a dynamic is really a case by case decision. Choose wisely. For more information about web design take a look at <a href="http://www.dreamcodesign.com/webdesign.php" title="Web Design">DreamCo Design</a> - <a href="http://www.dreamcodesign.com/webdesign.php" title="Web Design">Web Design</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dreamcodesign.com/blog/web-programming-static-vs-dynamic/feed/</wfw:commentRss>
		</item>
		<item>
		<title>What is .ASP / .NET good for?</title>
		<link>http://www.dreamcodesign.com/blog/what-is-asp-net-good-for/</link>
		<comments>http://www.dreamcodesign.com/blog/what-is-asp-net-good-for/#comments</comments>
		<pubDate>Thu, 23 Aug 2007 14:46:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[ASP / .NET]]></category>

		<guid isPermaLink="false">http://www.dreamcodesign.com/blog/?p=32</guid>
		<description><![CDATA[ASP = Active Server Pages.
You can always count on good ol&#8217; Microsoft to try to do their own thing and launch their own great programming languages. Many websites and web based applications have gone away from .ASP in recent years and this can be seen simply by browsing the web. You will see a lot [...]]]></description>
			<content:encoded><![CDATA[<p>ASP = Active Server Pages.</p>
<p>You can always count on good ol&#8217; Microsoft to try to do their own thing and launch their own great programming languages. Many websites and web based applications have gone away from .ASP in recent years and this can be seen simply by browsing the web. You will see a lot of the older websites that have shopping carts, or database applications use .ASP, which is fine in some cases but not always.</p>
<p>Unlike PHP / MYSQL, .ASP can be very difficult to work with and it is a lot more proprietary. A developer working with .ASP can easily set the website up to be difficult to be modified unless being modified by him or someone that knows how it was setup. There are just a few ways to really use the code and apply it to get the same result. Thus you get hostage held websites that only the original guy can work on.</p>
<p>Newer versions of .ASP / .NET are actually stable and are good for large websites and large web based applications. Smaller sites, and online stores have no real need for this language though and utilizing it would be forcing something that is not needed.</p>
<p>Though our company has people well rounded in .ASP / .NET we rarely apply it. Typically most applications can be done using PHP / MYSQL, and if security is a major concern, there are other languages out there that are considered first.</p>
<p>The bottom line is that microsoft continues to shove this language down the throats of programmers and people go to school specifically for it, but today it makes up a small percentage of what is utilized. We consider .ASP great for very specific and large projects, but potentially the worst solution to apply for common sites needing programming. I guess it is all in the opinion of the programmer though, just like the visual side of web design.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dreamcodesign.com/blog/what-is-asp-net-good-for/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Regular Expressions in PHP</title>
		<link>http://www.dreamcodesign.com/blog/8/</link>
		<comments>http://www.dreamcodesign.com/blog/8/#comments</comments>
		<pubDate>Wed, 07 Mar 2007 19:10:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Web Programming]]></category>

		<guid isPermaLink="false">http://www.dreamcodesign.com/blog/?p=9</guid>
		<description><![CDATA[ 
Regular Expressions Tutorial
 
It&#8217;s very hard to find one complete source for information on the internet to learn about regular expressions in PHP.  It&#8217;s one of the most intimidating things when coding using PHP, especially when you&#8217;re still trying to learn about it.  The collection below is all of the information I [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><strong><span>Regular Expressions Tutorial<o :p></o></span></strong></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span>It&#8217;s very hard to find one complete source for information on the internet to learn about regular expressions in PHP.</span><span>  </span>It&#8217;s one of the most intimidating things when coding using PHP, especially when you&#8217;re still trying to learn about it.<span>  </span>The collection below is all of the information I could collect on and about regular expressions in PHP and I figured it would be a good idea to post them here so others didn&#8217;t have the same problems as I have had in the past.<span>  </span>I have included links to the websites I pulled the information from, and if I didn&#8217;t then I got it from the main PHP.net website.<o :p></o></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span>Enjoy!</span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span id="more-9"></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><strong><span>Basic Syntax of Regular Expressions (as from PHPBuilder.com)<o :p></o></span></strong></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>First of all, let&#8217;s take a look at two special symbols: &#8216;^&#8217; and &#8216;$&#8217;. What they do is indicate the<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>start and the end of a string, respectively, like this:<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;^The&#8221;: matches any string that starts with &#8220;The&#8221;;<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;of despair$&#8221;: matches a string that ends in the substring &#8220;of despair&#8221;;<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;^abc$&#8221;: a string that starts and ends with &#8220;abc&#8221; &#8212; that could only be &#8220;abc&#8221; itself!<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;notice&#8221;: a string that has the text &#8220;notice&#8221; in it.<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>You can see that if you don&#8217;t use either of the two characters we mentioned, as in the last example,<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>you&#8217;re saying that the pattern may occur anywhere inside the string &#8212; you&#8217;re not &#8220;hooking&#8221; it to any of the edges.<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>There are also the symbols &#8216;*&#8217;, &#8216;+&#8217;, and &#8216;?&#8217;, which denote the number of times a character or a sequence of<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>characters may occur. What they mean is: &#8220;zero or more&#8221;, &#8220;one or more&#8221;, and &#8220;zero or one.&#8221; Here are some examples:<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;ab*&#8221;: matches a string that has an a followed by zero or more b&#8217;s (&#8221;a&#8221;, &#8220;ab&#8221;, &#8220;abbb&#8221;, etc.);<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;ab+&#8221;: same, but there&#8217;s at least one b (&#8221;ab&#8221;, &#8220;abbb&#8221;, etc.);<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;ab?&#8221;: there might be a b or not;<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;a?b+$&#8221;: a possible a followed by one or more b&#8217;s ending a string.<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>You can also use bounds, which come inside braces and indicate ranges in the number of occurences:<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;ab{2}&#8221;: matches a string that has an a followed by exactly two b&#8217;s (&#8221;abb&#8221;);<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;ab{2,}&#8221;: there are at least two b&#8217;s (&#8221;abb&#8221;, &#8220;abbbb&#8221;, etc.);<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;ab{3,5}&#8221;: from three to five b&#8217;s (&#8221;abbb&#8221;, &#8220;abbbb&#8221;, or &#8220;abbbbb&#8221;).<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>Note that you must always specify the first number of a range (i.e, &#8220;{0,2}&#8221;, not &#8220;{,2}&#8221;). Also, as you might<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>have noticed, the symbols &#8216;*&#8217;, &#8216;+&#8217;, and &#8216;?&#8217; have the same effect as using the bounds &#8220;{0,}&#8221;, &#8220;{1,}&#8221;, and &#8220;{0,1}&#8221;,<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>respectively.<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><br />
<script type="text/javascript"> <!-- google_ad_client = "pub-2951450649862551"; google_ad_width = 300; google_ad_height = 250; google_ad_format = "300x250_as"; google_ad_type = "text_image"; google_ad_channel =""; google_color_border = "666666"; google_color_bg = "666666"; google_color_link = "FFFFFF"; google_color_url = "FFFFFF"; google_color_text = "FFFFFF"; //--> </script><o :p> </o></p>
<p></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><br />
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script><o :p> </o></p>
<p></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>Now, to quantify a sequence of characters, put them inside parentheses:<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;a(bc)*&#8221;: matches a string that has an a followed by zero or more copies of the sequence &#8220;bc&#8221;;<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;a(bc){1,5}&#8221;: one through five copies of &#8220;bc.&#8221;<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>There&#8217;s also the &#8216;|&#8217; symbol, which works as an OR operator:<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;hi|hello&#8221;: matches a string that has either &#8220;hi&#8221; or &#8220;hello&#8221; in it;<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;(b|cd)ef&#8221;: a string that has either &#8220;bef&#8221; or &#8220;cdef&#8221;;<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;(a|b)*c&#8221;: a string that has a sequence of alternating a&#8217;s and b&#8217;s ending in a c;<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>A period (&#8217;.') stands for any single character:<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;a.[0-9]&#8220;: matches a string that has an a followed by one character and a digit;<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;^.{3}$&#8221;: a string with exactly 3 characters.<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>Bracket expressions specify which characters are allowed in a single position of a string:<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;[ab]&#8220;: matches a string that has either an a or a b (that&#8217;s the same as &#8220;a|b&#8221;);<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;[a-d]&#8220;: a string that has lowercase letters &#8216;a&#8217; through &#8216;d&#8217; (that&#8217;s equal to &#8220;a|b|c|d&#8221; and even &#8220;[abcd]&#8220;);<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;^[a-zA-Z]&#8220;: a string that starts with a letter;<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;[0-9]%&#8221;: a string that has a single digit before a percent sign;<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;,[a-zA-Z0-9]$&#8221;: a string that ends in a comma followed by an alphanumeric character.<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>You can also list which characters you DON&#8217;T want &#8212; just use a &#8216;^&#8217; as the first symbol in a bracket expression<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>(i.e., &#8220;%[^a-zA-Z]%&#8221; matches a string with a character that is not a letter between two percent signs).<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>In order to be taken literally, you must escape the characters &#8220;^.[$()|*+?{\" with a backslash ('\'), as<br />
<!--[if !supportLineBreakNewLine]&#8211;><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>they have special meaning. On top of that, you must escape the backslash character itself in PHP3 strings, so,<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>for instance, the regular expression &#8220;(\$|¥)[0-9]+&#8221; would have the function call: ereg(&#8221;(\\$|¥)[0-9]+&#8221;, $str)<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>(what string does that validate?)<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><strong><span>Example 1.</span></strong><span> Examples of valid patterns<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>* /&lt;\/\w+&gt;/<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>* |(\d{3})-\d+|Sm<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>* /^(?i)php[34]/<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>* {^\s+(\s+)?$}<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><strong><span>Example 2.</span></strong><span> Examples of invalid patterns<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>* /href=&#8217;(.*)&#8217; - missing ending delimiter<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>* /\w+\s*\w+/J - unknown modifier &#8216;J&#8217;<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>* 1-\d3-\d3-\d4| - missing starting delimiter<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><strong><span>Some useful PHP Keywords and their use<o :p></o></span></strong></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><strong><em><span>preg_split</span></em></strong><strong><span><o :p></o></span></strong></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>(PHP 3&gt;= 3.0.9, PHP 4 )<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>preg_split &#8212; Split string by a regular expression<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>Description<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>array preg_split ( string pattern, string subject [, int limit [, int flags]])<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>Returns an array containing substrings of subject split along boundaries matched by pattern.<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>If limit is specified, then only substrings up to limit are returned, and if limit is -1, it<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>actually means &#8220;no limit&#8221;, which is useful for specifying the flags.<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>flags can be any combination of the following flags (combined with bitwise | operator):<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>PREG_SPLIT_NO_EMPTY<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>If this flag is set, only non-empty pieces will be returned by preg_split().<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>PREG_SPLIT_DELIM_CAPTURE<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>If this flag is set, parenthesized expression in the delimiter pattern will be captured and<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>returned as well. This flag was added for 4.0.5.<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>PREG_SPLIT_OFFSET_CAPTURE<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>If this flag is set, for every occuring match the appendant string offset will also be<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>returned. Note that this changes the return value in an array where every element is an<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>array consisting of the matched string at offset 0 and it&#8217;s string offset into subject<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>at offset 1. This flag is available since PHP 4.3.0 .<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><strong><span>Example 1. </span></strong><span>preg_split() example : Get the parts of a search string<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&lt;?php<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>// split the phrase by any number of commas or space characters,<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>// which include &#8221; &#8220;, \r, \t, \n and \f<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>$keywords = preg_split (&#8221;/[\s,]+/&#8221;, &#8220;hypertext language, programming&#8221;);<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>?&gt;<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><strong><span>Example 2. </span></strong><span>Splitting a string into component characters<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&lt;?php<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>$str = &#8217;string&#8217;;<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>$chars = preg_split(&#8217;//&#8217;, $str, -1, PREG_SPLIT_NO_EMPTY);<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>print_r($chars);<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>?&gt;<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><strong><span>Example 3. </span></strong><span>Splitting a string into matches and their offsets<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&lt;?php<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>$str = &#8216;hypertext language programming&#8217;;<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>$chars = preg_split(&#8217;/ /&#8217;, $str, -1, PREG_SPLIT_OFFSET_CAPTURE);<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>print_r($chars);<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>?&gt;<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>will yield:<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>Array<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>(<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>[0] =&gt; Array<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>(<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>[0] =&gt; hypertext<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>[1] =&gt; 0<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>)<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>[1] =&gt; Array<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>(<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>[0] =&gt; language<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>[1] =&gt; 10<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>)<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>[2] =&gt; Array<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>(<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>[0] =&gt; programming<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>[1] =&gt; 19<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>)<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>)<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><em><span>Note: Parameter flags was added in PHP 4 Beta 3.</span></em><span><o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><strong><em><span>preg_match</span></em></strong><strong><span><o :p></o></span></strong></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>(PHP 3&gt;= 3.0.9, PHP 4 )<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>preg_match &#8212; Perform a regular expression match<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>Description<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>int preg_match ( string pattern, string subject [, array matches [, int flags]])<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>Searches subject for a match to the regular expression given in pattern.<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>If matches is provided, then it is filled with the results of search. $matches[0] will<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>contain the text that matched the full pattern, $matches[1] will have the text that matched<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>the first captured parenthesized subpattern, and so on.<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>flags can be the following flag:<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>PREG_OFFSET_CAPTURE<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>If this flag is set, for every occuring match the appendant string offset will also<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>be returned. Note that this changes the return value in an array where every element<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>is an array consisting of the matched string at offset 0 and it&#8217;s string offset into<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>subject at offset 1. This flag is available since PHP 4.3.0 .<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>The flags parameter is available since PHP 4.3.0 .<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><em><span>preg_match()</span></em><span> returns the number of times pattern matches. That will be either 0 times<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>(no match) or 1 time because preg_match() will stop searching after the first match.<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><em><span>preg_match_all()</span></em><span> on the contrary will continue until it reaches the end of subject.<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><em><span>preg_match()</span></em><span> returns FALSE if an error occured.<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>Tip: Do not use preg_match() if you only want to check if one string is contained<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>in another string. Use strpos() or strstr() instead as they will be faster.<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><strong><span>Example 1.</span></strong><span> Find the string of text &#8220;php&#8221;<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&lt;?php<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>// The &#8220;i&#8221; after the pattern delimiter indicates a case-insensitive search<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>if (preg_match (&#8221;/php/i&#8221;, &#8220;PHP is the web scripting language of choice.&#8221;)) {<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>print &#8220;A match was found.&#8221;;<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>} else {<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>print &#8220;A match was not found.&#8221;;<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>}<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>?&gt;<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&lt;strong&gt;Example 2.&lt;/strong&gt; Find the word &#8220;web&#8221;<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&lt;?php<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>/* The \b in the pattern indicates a word boundary, so only the distinct<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>* word &#8220;web&#8221; is matched, and not a word partial like &#8220;webbing&#8221; or &#8220;cobweb&#8221; */<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>if (preg_match (&#8221;/\bweb\b/i&#8221;, &#8220;PHP is the web scripting language of choice.&#8221;)) {<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>print &#8220;A match was found.&#8221;;<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>} else {<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>print &#8220;A match was not found.&#8221;;<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>}<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>if (preg_match (&#8221;/\bweb\b/i&#8221;, &#8220;PHP is the website scripting language of choice.&#8221;)) {<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>print &#8220;A match was found.&#8221;;<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>} else {<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>print &#8220;A match was not found.&#8221;;<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>}<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>?&gt;<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&lt;strong&gt;Example 3.&lt;/strong&gt; Getting the domain name out of a URL<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&lt;?php<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>// get host name from URL<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>preg_match(&#8221;/^(http:\/\/)?([^\/]+)/i&#8221;,<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>&#8220;http://www.php.net/index.html&#8221;, $matches);<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>$host = $matches[2];<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>// get last two segments of host name<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>preg_match(&#8221;/[^\.\/]+\.[^\.\/]+$/&#8221;, $host, $matches);<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>echo &#8220;domain name is: {$matches[0]}\n&#8221;;<br />
<!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--><o :p></o></span>
</p>
<p class="MsoNormal" style="line-height: normal"><span>?&gt;<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>This example will produce:<o :p></o></span></p>
<p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal"><span><o :p> </o></span></p>
<p class="MsoNormal" style="line-height: normal"><span>domain name is: php.net<o :p></o></span></p>
<p class="MsoNormal"><o :p> </o></p>
]]></content:encoded>
			<wfw:commentRss>http://www.dreamcodesign.com/blog/8/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
