<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4109498437077009704</id><updated>2024-11-08T07:40:52.454-08:00</updated><category term="Affiliate"/><category term="Builder"/><category term="To"/><category term="Your"/><category term="&amp;"/><category term="(Using"/><category term="301 Permanent redirects for parked domain names"/><category term="5"/><category term="ARMY"/><category term="Affiliates"/><category term="Anticipated"/><category term="Best"/><category term="Block Bad robots"/><category term="Building"/><category term="CSS3"/><category term="Change PHP variables using .htaccess"/><category term="Change default directory page"/><category term="Coding"/><category term="Course"/><category term="Create"/><category term="Disable Hot-Linking of images and other files"/><category term="Duplicate content fix index.html vs / (slash only)"/><category term="Enable CGI"/><category term="Force SSL/https using .htaccess and mod_rewrite"/><category term="Force www vs non-www to avoid duplicate content on Google"/><category term="Grow"/><category term="HTML5"/><category term="HTTP Authentication with PHP running as CGI/SuExec"/><category term="Highly"/><category term="How"/><category term="How to add Mime-Types using .htaccess"/><category term="How to block users from accessing your site based on their IP address"/><category term="How to change the error documents – 404 Page Not Found"/><category term="How to prevent or allow directory listing?"/><category term="Java)"/><category term="Language"/><category term="Launch"/><category term="Make PHP to work in your HTML files with .htacess"/><category term="My"/><category term="Own"/><category term="PHP 101 (PART 12): BUGGING OUT – PART 2"/><category term="PHP 101 (PART 9): SQLITE MY FIRE! – PART 2"/><category term="PHP 101 (part 1): Down the Rabbit Hole"/><category term="PHP 101 (part 10): A Session In The Cookie Jar"/><category term="PHP 101 (part 11): Sinfully Simple"/><category term="PHP 101 (part 12): Bugging Out – Part 1"/><category term="PHP 101 (part 13): The Trashman Cometh – Part 1"/><category term="PHP 101 (part 13): The Trashman Cometh – Part 2"/><category term="PHP 101 (part 14): No News is Good News"/><category term="PHP 101 (part 2): Calling All Operators"/><category term="PHP 101 (part 3): Looping The Loop"/><category term="PHP 101 (part 4): The Food Factor"/><category term="PHP 101 (part 5): Rank and File"/><category term="PHP 101 (part 6): Functionally Yours"/><category term="PHP 101 (part 7): The Bear Necessities"/><category term="PHP 101 (part 7): The Bear Necessities – Part 2"/><category term="PHP 101 (part 8): Databases and Other Animals – Part 1"/><category term="PHP 101 (part 8): Databases and Other Animals – Part 2"/><category term="PHP 101 (part 9): SQLite My Fire! – Part 1"/><category term="Profits"/><category term="Programming"/><category term="Redirect URLs using .htaccess"/><category term="Review"/><category term="Ruby"/><category term="SSI with .htaccess"/><category term="Sites"/><category term="Slick"/><category term="Software"/><category term="Super"/><category term="Tool"/><category term="Training"/><category term="Tutorials"/><category term="Using .htaccess for password protecting your folders"/><category term="Using .htaccess to block referrer spam"/><category term="WP"/><category term="WP-Affiliate"/><category term="and"/><category term="and/or"/><category term="crawlers and harvesters"/><category term="css"/><category term="etc"/><category term="for"/><category term="force"/><category term="form"/><category term="htaccess"/><category term="html"/><category term="https"/><category term="login"/><category term="music"/><category term="on"/><category term="php"/><category term="project"/><category term="prowling"/><category term="spiders"/><category term="ssl"/><category term="with"/><title type='text'>The Coders Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default?start-index=26&amp;max-results=25'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>45</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-4812971849127228426</id><published>2014-01-25T18:15:00.000-08:00</published><updated>2014-01-25T18:15:04.201-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Affiliate"/><category scheme="http://www.blogger.com/atom/ns#" term="ARMY"/><category scheme="http://www.blogger.com/atom/ns#" term="Building"/><category scheme="http://www.blogger.com/atom/ns#" term="Grow"/><category scheme="http://www.blogger.com/atom/ns#" term="Profits"/><category scheme="http://www.blogger.com/atom/ns#" term="To"/><category scheme="http://www.blogger.com/atom/ns#" term="Your"/><title type='text'>Building Your Affiliate ARMY to Grow Your Profits</title><content type='html'>The average Internet Marketer does not approach the product “launch process” properly. They spend time creating an awesome product only to fall short of reaching their income goal. They just don’t get the affiliate support they need to hit their sales goal.&lt;br /&gt;
&lt;br /&gt;
Why do you think that so many fail when it comes to building their affiliate army? Why do you think that so many internet marketers believe that “if they build it, they will come?” The reality is, that if you build an amazing product your sales are not just going to appear.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
There are Internet Marketers that think that by posting on a product on a particular selling platform that they are going to make tons of money by default. For example, posting their product offer on a forum. Many people solely rely on “organic platform traffic.” The reality is this, if you were to go to the Warrior Forum and you were to post an offer today, and do ZERO traffic driving, and use no kind of affiliate network just depending on organic traffic in the forum… your “launch” would likely be a complete failure.&lt;br /&gt;
&lt;br /&gt;
Building an affiliate army is crucial to your launch&#39;s success. &amp;nbsp;You have to set aside time for this and you have to follow a plan if you want to get powerful affiliates on board to promote your launch. Remember, that when you&#39;re recruiting for your army that the super affiliates are business people. Before you try recruiting them, you need to make sure that you’ve got all your ducks in a row. You should get to know them first because a stranger may perceive your launch as “risky.” This is their business and they have to make sure that their income continues to come in. If they don’t know you, they just have to “TRUST” that your offer will convert well and that you will treat their customers properly.&lt;br /&gt;
&lt;br /&gt;
There are two super affiliates that recently covered this in great detail. These 2 guys are always at the top of the leaderboard for huge launches and they opened my eyes to quite a few important Affiliate Recruitment Tactics. Omar Martin &amp;amp; Dave Nicholson know EXACTLY what to do and have generated millions of dollars online. Together they created an awesome product on how to recruit affiliates and create buzz for your launch. The product is called WP-Affiliate Builder and you can check it out here: http://gamzervers.wpaffbuild.hop.clickbank.net&lt;br /&gt;
&lt;br /&gt;
When you get inside of the WP-Affiliate Builder members area you&#39;ll find an ebook with 7 chapters of tactics that will help you grow your army, there’s also an audio version so you can download it and listen to it on the go. The site also has JV video training that teaches you the exact steps that Omar Martin &amp;amp; Dave Nicholson themselves use to teach their affiliates how to make money by promoting your products. They include a JV blog development training section that will teach you how to create the JV pages that your affiliates need in order to be armed to promote your product PROPERLY.&lt;br /&gt;
These videos are not only going to teach you what you need to know, but it&#39;s going to provide you with the resources to do it well. WP-Affiliate Builder is more than just training, it provides you with Word PRess plugins that help automate a huge part of your product launches.&lt;br /&gt;
&lt;br /&gt;
The site is absolutely amazing. You definitely don’t want to miss out on what these guys have going on. &amp;nbsp;You should definitely go right now to get access to their site. You won’t be disappointed. I hope to see you there:&lt;br /&gt;
&lt;br /&gt;
http://gamzervers.wpaffbuild.hop.clickbank.net&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/4812971849127228426/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2014/01/building-your-affiliate-army-to-grow.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/4812971849127228426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/4812971849127228426'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2014/01/building-your-affiliate-army-to-grow.html' title='Building Your Affiliate ARMY to Grow Your Profits'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-1117851430989572749</id><published>2014-01-25T18:13:00.003-08:00</published><updated>2014-01-25T18:14:00.623-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Affiliate"/><category scheme="http://www.blogger.com/atom/ns#" term="Builder"/><category scheme="http://www.blogger.com/atom/ns#" term="My"/><category scheme="http://www.blogger.com/atom/ns#" term="on"/><category scheme="http://www.blogger.com/atom/ns#" term="Review"/><category scheme="http://www.blogger.com/atom/ns#" term="WP"/><title type='text'>My Review on WP Affiliate Builder</title><content type='html'>I&#39;ve got a special treat for you today.&lt;br /&gt;
&lt;br /&gt;
I&#39;ve just finished reviewing the brand new WP Affiliate Builder software and training program and I have to say it&#39;s pretty damn AWESOME!&lt;br /&gt;
&lt;br /&gt;
Inside the robust members area of WP Affiliate Builder you get a complete arsenal of tools, software and training that is specifically designed to help you to Recruit and Equip your Affiliates.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
It&#39;s been created by 2 affiliate MASTERS called Omar Martin and Dave Nicholson, and these guys have thought of EVERYTHING you could possibly need in order to start building a MASSIVE affiliate following.&lt;br /&gt;
&lt;br /&gt;
You get the Wordpress Affiliate Builder Software Plugin to enable you to INSTANTLY and SIMPLY build your affiliates page with all the tools needed in minutes.&lt;br /&gt;
&lt;br /&gt;
Plus, you can also get a fantastic Wordpress JV Leaderboard Software Plugin that automatically displays and updates your Top Affiliates, I found that excellent for building launch buzz and persuading affiliates to mail multiple times. Everybody wants to be the winner... Right? :-)&lt;br /&gt;
&lt;br /&gt;
As well as the TWO really powerful Wordpress software plugins, you ALSO get Top Quality Affiliate Video Training, Affiliate eBook Training and Affiliate Audio Training from Omar and Dave. Two REAL LIFE EXPERTS that show you how to do everything very simply. Their style is very entertaining and engaging too!&lt;br /&gt;
&lt;br /&gt;
All in all, this is one software package and training course that you really DO NOT want to miss out on.&lt;br /&gt;
&lt;br /&gt;
I can give it my HIGHEST RECOMMENDATION and I take my hat off to Omar and Dave.&lt;br /&gt;
&lt;br /&gt;
Check it out for yourself here:&lt;br /&gt;
&lt;br /&gt;
http://gamzervers.wpaffbuild.hop.clickbank.net&lt;br /&gt;
&lt;br /&gt;
Regards,&lt;br /&gt;
&lt;br /&gt;
Casper</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/1117851430989572749/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2014/01/my-review-on-wp-affiliate-builder.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/1117851430989572749'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/1117851430989572749'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2014/01/my-review-on-wp-affiliate-builder.html' title='My Review on WP Affiliate Builder'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-953785603069659643</id><published>2014-01-21T04:49:00.003-08:00</published><updated>2014-01-25T18:12:40.941-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Affiliates"/><category scheme="http://www.blogger.com/atom/ns#" term="and"/><category scheme="http://www.blogger.com/atom/ns#" term="Anticipated"/><category scheme="http://www.blogger.com/atom/ns#" term="Builder"/><category scheme="http://www.blogger.com/atom/ns#" term="Course"/><category scheme="http://www.blogger.com/atom/ns#" term="Highly"/><category scheme="http://www.blogger.com/atom/ns#" term="Launch"/><category scheme="http://www.blogger.com/atom/ns#" term="Software"/><category scheme="http://www.blogger.com/atom/ns#" term="Super"/><category scheme="http://www.blogger.com/atom/ns#" term="Tool"/><category scheme="http://www.blogger.com/atom/ns#" term="Training"/><category scheme="http://www.blogger.com/atom/ns#" term="WP-Affiliate"/><title type='text'>Super Affiliates Launch Highly Anticipated WP-Affiliate Builder Training Course and Software Tool</title><content type='html'>&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;a href=&quot;http://gamzervers.wpaffbuild.hop.clickbank.net/&quot;&gt;&lt;img src=&quot;http://www.wp-affiliatebuilder.com/jvblog/wp-content/uploads/2013/06/550x4002.jpg&quot; /&gt;&lt;/a&gt;
&lt;/div&gt;
September 24, 2013&lt;br /&gt;
Palm Bay, FL – After nearly 2 years in development well respected Internet marketing super affiliates Omar Martin of Higher Level Strategies, Inc. &amp;amp; Dave Nicholson of Planet Divinity, Ltd. have opened the doors to their highly anticipated affiliate recruitment training course and software WP-AffiliateBuilder.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
In early 2012, Martin &amp;amp; Nicholson announced that they had teamed up to release the most robust and powerful JV attraction tool and training the industry has ever seen. The two super affiliates have dedicated the greater part of 2 years into producing this product which is comprised of over a dozen training videos, 7 PDF manuals including a 112 page book and audio course and lots more.&lt;br /&gt;
&lt;br /&gt;
Their WP-Affiliate Builder package also includes 2 pieces of custom software plugins for WordPress that they developed in conjunction with developer David Husnian of WebInsights, LLC. The first WordPress plugin empowers users to quickly generate a “brandable” tools page for their JV’s. This makes it easy for affiliates to personalize email swipes, banners and more to promote the users product.&lt;br /&gt;
&lt;br /&gt;
The second plugin is a Contest Leader Board creator for Clickbank which enables the user to generate auto updating affiliate sales statistics that the user can post on his/her JV blog in order to keep JV’s motivated and informed. This is the first “real time” leaderboard product of its kind for WordPress and Clickbank and it boasts tons of customization features as well as a powerful real time metrics display dashboard.&lt;br /&gt;
&lt;br /&gt;
Early this week Martin was quoted saying “This is by far the most comprehensive and up to date affiliate recruitment and product launch training on the market. This is cutting edge stuff that makes all the old product launch “formulas” pale by comparison.”&lt;br /&gt;
&lt;br /&gt;
The WP-Affiliate Builder software and Contest Leaderboard software has been in beta testing for well over a year and we have several big launches display their contest leaderboards with the plugin throughout this time. Beta testers have included the likes of John Thornill, Anthony Aries, Omar Martin, and Dave Nicholson themselves amongst others.&lt;br /&gt;
&lt;br /&gt;
This WPAB team has poised their launch of WP-Affiliate Builder for great success with a very bold pre launch campaign of their own. The duo totally dominated the social marketers space on Facebook for the entire month of September with the daily release of the WP-Affiliate Builder TIPS video series. “The web has literally been buzzing with anticipation of this product launch and we aim to change the way the industry trains their partners to make money promoting products” said Nicholson in a recent podcast interview.&lt;br /&gt;
&lt;br /&gt;
Learn more about the WP-Affiliate Builder product at: http://gamzervers.wpaffbuild.hop.clickbank.net</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/953785603069659643/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2014/01/super-affiliates-launch-highly.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/953785603069659643'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/953785603069659643'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2014/01/super-affiliates-launch-highly.html' title='Super Affiliates Launch Highly Anticipated WP-Affiliate Builder Training Course and Software Tool'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-1204471700684713113</id><published>2014-01-06T14:57:00.002-08:00</published><updated>2014-01-06T15:18:32.949-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="css"/><category scheme="http://www.blogger.com/atom/ns#" term="html"/><category scheme="http://www.blogger.com/atom/ns#" term="music"/><category scheme="http://www.blogger.com/atom/ns#" term="php"/><category scheme="http://www.blogger.com/atom/ns#" term="project"/><category scheme="http://www.blogger.com/atom/ns#" term="prowling"/><title type='text'>Prowling Music Project</title><content type='html'>&lt;span style=&quot;font-family: tahoma, helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 24.4375px;&quot;&gt;Well i make different web projects and use alot of time and money on it, but i belive this might be one of the best i ever made. I here give you a music script there scan all big services like yourtube and fm services for only HD or HQ videos/sounds and plays it for you. The music list is not limited at all and you can find all bands world wide on the site.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: tahoma, helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 24.4375px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: tahoma, helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 24.4375px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;span style=&quot;font-family: tahoma, helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 24.4375px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: tahoma, helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 24.4375px;&quot;&gt;atm do i only have it at a subdomain on my company site at http://replay.gamezervers.com&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: tahoma, helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 24.4375px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: tahoma, helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 24.4375px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: tahoma, helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 24.4375px;&quot;&gt;TRY IT OUT TEST IT TELL ME ! WHAT EVER !&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: tahoma, helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 24.4375px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: tahoma, helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 24.4375px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: tahoma, helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 24.4375px;&quot;&gt;The site got its own music player where it shows the top heard songs that it will play after the song you have choosed. (can be hidden or closed)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: tahoma, helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 24.4375px;&quot;&gt;If you have an user on the site can you add songs to favorite.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: tahoma, helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 24.4375px;&quot;&gt;Easy to find songs that it does not show random videos like youtube does.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: tahoma, helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 24.4375px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: tahoma, helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 24.4375px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: tahoma, helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 24.4375px;&quot;&gt;Band Profiles:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: tahoma, helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 24.4375px;&quot;&gt;Click image to see full.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br style=&quot;background-color: #1a1a1a; color: #bcbcbc; font-family: tahoma, helvetica, arial, sans-serif; font-size: 14.44444465637207px; line-height: 24.44444465637207px;&quot; /&gt;
&lt;span rel=&quot;lightbox&quot; style=&quot;background-color: #1a1a1a; color: #bcbcbc; font-family: tahoma, helvetica, arial, sans-serif; font-size: 14.44444465637207px; line-height: 24.44444465637207px;&quot;&gt;&lt;a href=&quot;http://prntscr.com/2h558p&quot;&gt;&lt;img alt=&quot;Posted Image&quot; class=&quot;bbc_img&quot; src=&quot;http://i.imgur.com/JJeXoNN.png&quot; height=&quot;320&quot; style=&quot;border: 0px; max-height: 800px !important; max-width: 800px !important; vertical-align: middle;&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br style=&quot;background-color: #1a1a1a; color: #bcbcbc; font-family: tahoma, helvetica, arial, sans-serif; font-size: 14.44444465637207px; line-height: 24.44444465637207px;&quot; /&gt;
&lt;span style=&quot;font-family: tahoma, helvetica, arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 24.4375px;&quot;&gt;THE PLAYER:&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br style=&quot;background-color: #1a1a1a; color: #bcbcbc; font-family: tahoma, helvetica, arial, sans-serif; font-size: 14.44444465637207px; line-height: 24.44444465637207px;&quot; /&gt;
&lt;span rel=&quot;lightbox&quot; style=&quot;background-color: #1a1a1a; color: #bcbcbc; font-family: tahoma, helvetica, arial, sans-serif; font-size: 14.44444465637207px; line-height: 24.44444465637207px;&quot;&gt;&lt;img alt=&quot;Posted Image&quot; class=&quot;bbc_img&quot; src=&quot;http://i.imgur.com/jBg0b1L.png&quot; height=&quot;640&quot; style=&quot;border: 0px; max-height: 800px !important; max-width: 800px !important; vertical-align: middle;&quot; width=&quot;607&quot; /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: #1a1a1a; color: #bcbcbc; font-family: tahoma, helvetica, arial, sans-serif; font-size: 14.44444465637207px; line-height: 24.44444465637207px;&quot;&gt;&amp;nbsp;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/1204471700684713113/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2014/01/prowling-music-project.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/1204471700684713113'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/1204471700684713113'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2014/01/prowling-music-project.html' title='Prowling Music Project'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-7089377752189781306</id><published>2013-12-26T07:25:00.000-08:00</published><updated>2013-12-27T08:19:49.638-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="&amp;"/><category scheme="http://www.blogger.com/atom/ns#" term="CSS3"/><category scheme="http://www.blogger.com/atom/ns#" term="form"/><category scheme="http://www.blogger.com/atom/ns#" term="HTML5"/><category scheme="http://www.blogger.com/atom/ns#" term="login"/><category scheme="http://www.blogger.com/atom/ns#" term="Slick"/><category scheme="http://www.blogger.com/atom/ns#" term="with"/><title type='text'>Slick login form with HTML5 &amp; CSS3</title><content type='html'>&lt;div style=&quot;background-color: whitesmoke; border: 0px; color: #373737; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 26px; margin-bottom: 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;http://static.guim.co.uk/sys-images/Guardian/Pix/pictures/2013/1/11/1357921737290/Masterclass-in-HTML5-and--006.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;192&quot; src=&quot;http://static.guim.co.uk/sys-images/Guardian/Pix/pictures/2013/1/11/1357921737290/Masterclass-in-HTML5-and--006.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
We already know that CSS3 has the ability to create a lot of new possibilities to design and implement better web forms. Also, HTML5 has its important role when it comes about creating more usable forms, without actually needing any Javascript code.&lt;/div&gt;
&lt;div style=&quot;background-color: whitesmoke; border: 0px; color: #373737; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 26px; margin-bottom: 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Knowing that, check out the below preview to see the login form we’re going to create in this article:&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: whitesmoke; border: 0px; color: #373737; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 26px; margin-bottom: 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;img alt=&quot;&quot; class=&quot;aligncenter size-full wp-image-3409&quot; height=&quot;200&quot; src=&quot;http://www.red-team-design.com/wp-content/uploads/2011/09/login-form.png&quot; style=&quot;border: 1px solid rgb(221, 221, 221); clear: both; display: block; height: auto; margin: 0.4em auto 1.625em; max-width: 97.5%; padding: 6px; width: auto;&quot; title=&quot;CSS3 &amp;amp; HTML5 login form&quot; width=&quot;600&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: whitesmoke; border: 0px; color: #373737; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 26px; margin-bottom: 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span id=&quot;more-3154&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;center buttons-para&quot; style=&quot;background-color: whitesmoke; border: 0px; color: #373737; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 26px; margin-bottom: 25px !important; margin-top: 25px !important; outline: 0px; padding: 0px; text-align: center !important; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;background-color: whitesmoke; border: 0px; clear: both; color: #373737; font-family: &#39;PT Sans Narrow&#39;, Calibri, &#39;Myriad Pro&#39;, Tahoma, Arial; font-size: 15px; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; text-transform: uppercase; vertical-align: baseline;&quot;&gt;
MARKUP&lt;/h3&gt;
&lt;pre class=&quot;prettyprint&quot; style=&quot;-webkit-box-shadow: rgba(0, 0, 0, 0.901961) 0px 1px 3px inset, rgb(255, 255, 255) 0px 2px 0px; background-color: #222222; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-shadow: rgba(0, 0, 0, 0.901961) 0px 1px 3px inset, rgb(255, 255, 255) 0px 2px 0px; color: #f1f2f3; font-family: &#39;Courier 10 Pitch&#39;, Courier, monospace; font-size: 15px; line-height: 1.5; margin-bottom: 1.625em; outline: 0px; overflow: auto; padding: 0.75em 1.625em; vertical-align: baseline;&quot;&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;form&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;atn&quot; style=&quot;border: 0px; color: #e0e2e4; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;atv&quot; style=&quot;border: 0px; color: #ec7600; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;login&quot;&lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Log In&lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;fieldset&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;atn&quot; style=&quot;border: 0px; color: #e0e2e4; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;atv&quot; style=&quot;border: 0px; color: #ec7600; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;inputs&quot;&lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;input&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;atn&quot; style=&quot;border: 0px; color: #e0e2e4; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;atv&quot; style=&quot;border: 0px; color: #ec7600; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;username&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;atn&quot; style=&quot;border: 0px; color: #e0e2e4; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;atv&quot; style=&quot;border: 0px; color: #ec7600; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;text&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;atn&quot; style=&quot;border: 0px; color: #e0e2e4; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;placeholder&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;atv&quot; style=&quot;border: 0px; color: #ec7600; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Username&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;atn&quot; style=&quot;border: 0px; color: #e0e2e4; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;autofocus&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;atn&quot; style=&quot;border: 0px; color: #e0e2e4; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;required&lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;   
        &lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;input&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;atn&quot; style=&quot;border: 0px; color: #e0e2e4; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;atv&quot; style=&quot;border: 0px; color: #ec7600; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;password&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;atn&quot; style=&quot;border: 0px; color: #e0e2e4; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;atv&quot; style=&quot;border: 0px; color: #ec7600; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;password&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;atn&quot; style=&quot;border: 0px; color: #e0e2e4; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;placeholder&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;atv&quot; style=&quot;border: 0px; color: #ec7600; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Password&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;atn&quot; style=&quot;border: 0px; color: #e0e2e4; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;required&lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/fieldset&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;fieldset&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;atn&quot; style=&quot;border: 0px; color: #e0e2e4; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;atv&quot; style=&quot;border: 0px; color: #ec7600; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;actions&quot;&lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;input&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;atn&quot; style=&quot;border: 0px; color: #e0e2e4; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;atv&quot; style=&quot;border: 0px; color: #ec7600; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;submit&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;atn&quot; style=&quot;border: 0px; color: #e0e2e4; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;atv&quot; style=&quot;border: 0px; color: #ec7600; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;submit&quot;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;atn&quot; style=&quot;border: 0px; color: #e0e2e4; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;atv&quot; style=&quot;border: 0px; color: #ec7600; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Log in&quot;&lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;a&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;atn&quot; style=&quot;border: 0px; color: #e0e2e4; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;atv&quot; style=&quot;border: 0px; color: #ec7600; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Forgot your password?&lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/a&amp;gt;&amp;lt;a&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;atn&quot; style=&quot;border: 0px; color: #e0e2e4; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;atv&quot; style=&quot;border: 0px; color: #ec7600; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Register&lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/fieldset&amp;gt;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;tag&quot; style=&quot;border: 0px; color: #8ac763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;h4 style=&quot;background-color: whitesmoke; border: 0px; clear: both; color: #373737; font-family: &#39;PT Sans Narrow&#39;, Calibri, &#39;Myriad Pro&#39;, Tahoma, Arial; font-size: 16px; font-weight: inherit; line-height: 26px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The HTML5 stuff&lt;/h4&gt;
&lt;div style=&quot;background-color: whitesmoke; border: 0px; color: #373737; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 26px; margin-bottom: 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
New HTML5 attributes descriptions, according to latest specifications:&lt;/div&gt;
&lt;ul style=&quot;background-color: whitesmoke; border: 0px; color: #373737; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 26px; list-style: square; margin: 0px 0px 1.625em 2.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;placeholder&lt;/strong&gt;&amp;nbsp;– A short hint (one word or a short phrase) intended to aid the user when entering data into the control represented by its element.&lt;/li&gt;
&lt;li style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;required&lt;/strong&gt;&amp;nbsp;– Specifies that the element is a required part of form submission.&lt;/li&gt;
&lt;li style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;autofocus&lt;/strong&gt;&amp;nbsp;– Specifies that the element represents a control to which a UA is meant to give focus as soon as the document is loaded.&lt;/li&gt;
&lt;li style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;border: 0px; font-family: inherit; font-style: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;type=”password”&lt;/strong&gt;&amp;nbsp;– Specifies that its input element is a one-line plain-text edit control for entering a password. (not HTML5 specific)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 style=&quot;background-color: whitesmoke; border: 0px; clear: both; color: #373737; font-family: &#39;PT Sans Narrow&#39;, Calibri, &#39;Myriad Pro&#39;, Tahoma, Arial; font-size: 15px; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; text-transform: uppercase; vertical-align: baseline;&quot;&gt;
THE CSS&lt;/h3&gt;
&lt;div style=&quot;background-color: whitesmoke; border: 0px; color: #373737; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 26px; margin-bottom: 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
For this article, I will not paste the whole lines here. Instead, I’ll just add the ones who help creating some cool effects.&lt;/div&gt;
&lt;h4 style=&quot;background-color: whitesmoke; border: 0px; clear: both; color: #373737; font-family: &#39;PT Sans Narrow&#39;, Calibri, &#39;Myriad Pro&#39;, Tahoma, Arial; font-size: 16px; font-weight: inherit; line-height: 26px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Paper stack effect&lt;/h4&gt;
&lt;div style=&quot;background-color: whitesmoke; border: 0px; color: #373737; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 26px; margin-bottom: 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Box-shadow&amp;nbsp;will help us creating this nice effect by defining multiple shadows that actually overlap.&lt;/div&gt;
&lt;div style=&quot;background-color: whitesmoke; border: 0px; color: #373737; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 26px; margin-bottom: 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;img alt=&quot;&quot; class=&quot;aligncenter size-full wp-image-3416&quot; height=&quot;200&quot; src=&quot;http://www.red-team-design.com/wp-content/uploads/2011/09/paper-stack-effect.png&quot; style=&quot;border: 1px solid rgb(221, 221, 221); clear: both; display: block; height: auto; margin: 0.4em auto 1.625em; max-width: 97.5%; padding: 6px; width: auto;&quot; title=&quot;Paper stack effect&quot; width=&quot;600&quot; /&gt;&lt;/div&gt;
&lt;pre class=&quot;prettyprint&quot; style=&quot;-webkit-box-shadow: rgba(0, 0, 0, 0.901961) 0px 1px 3px inset, rgb(255, 255, 255) 0px 2px 0px; background-color: #222222; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-shadow: rgba(0, 0, 0, 0.901961) 0px 1px 3px inset, rgb(255, 255, 255) 0px 2px 0px; color: #f1f2f3; font-family: &#39;Courier 10 Pitch&#39;, Courier, monospace; font-size: 15px; line-height: 1.5; margin-bottom: 1.625em; outline: 0px; overflow: auto; padding: 0.75em 1.625em; vertical-align: baseline;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#login&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    box&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;shadow&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
          &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2px&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; rgba&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0.2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;  
          &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1px&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1px&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; rgba&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
          &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;3px&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#fff,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
          &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;4px&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; rgba&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
          &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;6px&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#fff,  &lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
          &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;7px&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; rgba&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;h4 style=&quot;background-color: whitesmoke; border: 0px; clear: both; color: #373737; font-family: &#39;PT Sans Narrow&#39;, Calibri, &#39;Myriad Pro&#39;, Tahoma, Arial; font-size: 16px; font-weight: inherit; line-height: 26px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Stitch effect&lt;/h4&gt;
&lt;div style=&quot;background-color: whitesmoke; border: 0px; color: #373737; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 26px; margin-bottom: 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
This effect is added using&amp;nbsp;pseudo-elements. Using pseudo-elements helps you avoid extra markup and this is a perfect example: keep the markup clean and let the CSS do the magic.&lt;/div&gt;
&lt;div style=&quot;background-color: whitesmoke; border: 0px; color: #373737; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 26px; margin-bottom: 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;img alt=&quot;&quot; class=&quot;aligncenter size-full wp-image-3419&quot; height=&quot;200&quot; src=&quot;http://www.red-team-design.com/wp-content/uploads/2011/09/stitch-effect.png&quot; style=&quot;border: 1px solid rgb(221, 221, 221); clear: both; display: block; height: auto; margin: 0.4em auto 1.625em; max-width: 97.5%; padding: 6px; width: auto;&quot; title=&quot;CSS stitch effect&quot; width=&quot;600&quot; /&gt;&lt;/div&gt;
&lt;pre class=&quot;prettyprint&quot; style=&quot;-webkit-box-shadow: rgba(0, 0, 0, 0.901961) 0px 1px 3px inset, rgb(255, 255, 255) 0px 2px 0px; background-color: #222222; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-shadow: rgba(0, 0, 0, 0.901961) 0px 1px 3px inset, rgb(255, 255, 255) 0px 2px 0px; color: #f1f2f3; font-family: &#39;Courier 10 Pitch&#39;, Courier, monospace; font-size: 15px; line-height: 1.5; margin-bottom: 1.625em; outline: 0px; overflow: auto; padding: 0.75em 1.625em; vertical-align: baseline;&quot;&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#login&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    position&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; absolute&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    z&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;

&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#login:before&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    content&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;border: 0px; color: #ec7600; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    position&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; absolute&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    z&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;index&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    border&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1px&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; dashed &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#ccc;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    top&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;5px&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    bottom&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;5px&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    left&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;5px&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    right&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;5px&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;moz&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;box&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;shadow&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1px&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#fff;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;webkit&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;box&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;shadow&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1px&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#fff;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    box&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;shadow&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1px&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#fff;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;div style=&quot;background-color: whitesmoke; border: 0px; color: #373737; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 26px; margin-bottom: 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;em style=&quot;border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Styles excerpt.&lt;/em&gt;&lt;/div&gt;
&lt;h4 style=&quot;background-color: whitesmoke; border: 0px; clear: both; color: #373737; font-family: &#39;PT Sans Narrow&#39;, Calibri, &#39;Myriad Pro&#39;, Tahoma, Arial; font-size: 16px; font-weight: inherit; line-height: 26px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Subtle gradient lines&lt;/h4&gt;
&lt;div style=&quot;background-color: whitesmoke; border: 0px; color: #373737; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 26px; margin-bottom: 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
I’ve first seen this effect on&amp;nbsp;&lt;a href=&quot;http://playground.genelocklin.com/gradient-hr/&quot; style=&quot;border: 0px; color: #1982d1; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;Gene Locklin&lt;/a&gt;‘s page and I thought this is pretty cool. So, I decided to use it for highlighting the “Log in” heading. Using pseudo-elements (again) and&amp;nbsp;CSS3 gradients&amp;nbsp;some cool lines are added to simulate a strikeout effect.&lt;/div&gt;
&lt;div style=&quot;background-color: whitesmoke; border: 0px; color: #373737; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 26px; margin-bottom: 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;img alt=&quot;&quot; class=&quot;aligncenter size-full wp-image-3422&quot; height=&quot;200&quot; src=&quot;http://www.red-team-design.com/wp-content/uploads/2011/09/heading-gradient-lines.png&quot; style=&quot;border: 1px solid rgb(221, 221, 221); clear: both; display: block; height: auto; margin: 0.4em auto 1.625em; max-width: 97.5%; padding: 6px; width: auto;&quot; title=&quot;Heading gradient lines&quot; width=&quot;600&quot; /&gt;&lt;/div&gt;
&lt;pre class=&quot;prettyprint&quot; style=&quot;-webkit-box-shadow: rgba(0, 0, 0, 0.901961) 0px 1px 3px inset, rgb(255, 255, 255) 0px 2px 0px; background-color: #222222; border-bottom-left-radius: 3px; border-bottom-right-radius: 3px; border-top-left-radius: 3px; border-top-right-radius: 3px; border: 0px; box-shadow: rgba(0, 0, 0, 0.901961) 0px 1px 3px inset, rgb(255, 255, 255) 0px 2px 0px; color: #f1f2f3; font-family: &#39;Courier 10 Pitch&#39;, Courier, monospace; font-size: 15px; line-height: 1.5; margin-bottom: 1.625em; outline: 0px; overflow: auto; padding: 0.75em 1.625em; vertical-align: baseline;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;h1
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    text&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;shadow&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1px&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; rgba&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;255&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;),&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0px&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2px&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; rgba&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    text&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; uppercase&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    text&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;align&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; center&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    color&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#666;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    margin&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;30px&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    letter&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;spacing&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;4px&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    font&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; normal &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;26px&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;border: 0px; color: #678cb1; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Verdana&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;typ&quot; style=&quot;border: 0px; color: #678cb1; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Helvetica&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    position&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; relative&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;

h1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;after&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; h1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;before
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    background&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;color&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#777;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    content&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;border: 0px; color: #ec7600; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    height&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1px&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    position&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; absolute&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    top&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;15px&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    width&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;120px&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;   
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;

h1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;after
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; 
    background&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;webkit&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;gradient&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;linear&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; left top&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; right top&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;border: 0px; color: #93c763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#777), to(#fff));&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    background&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;webkit&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;linear&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;gradient&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#777, #fff);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    background&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;moz&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;linear&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;gradient&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#777, #fff);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    background&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ms&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;linear&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;gradient&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#777, #fff);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    background&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;o&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;linear&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;gradient&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#777, #fff);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    background&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; linear&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;gradient&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;left&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#777, #fff);      &lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    right&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;

h1&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;before
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    background&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;webkit&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;gradient&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;linear&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; right top&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; left top&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kwd&quot; style=&quot;border: 0px; color: #93c763; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#777), to(#fff));&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    background&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;webkit&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;linear&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;gradient&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#777, #fff);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    background&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;moz&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;linear&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;gradient&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#777, #fff);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    background&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ms&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;linear&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;gradient&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#777, #fff);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    background&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;o&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;linear&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;gradient&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#777, #fff);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    background&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; linear&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;gradient&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;right&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #66747b; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;#777, #fff);&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
    left&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;lit&quot; style=&quot;border: 0px; color: #facd22; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;h3 style=&quot;background-color: whitesmoke; border: 0px; clear: both; color: #373737; font-family: &#39;PT Sans Narrow&#39;, Calibri, &#39;Myriad Pro&#39;, Tahoma, Arial; font-size: 15px; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; text-transform: uppercase; vertical-align: baseline;&quot;&gt;
THE FINAL RESULT&lt;/h3&gt;
&lt;div style=&quot;background-color: whitesmoke; border: 0px; color: #373737; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 26px; margin-bottom: 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Using the above techniques, here’s the final result:&lt;/div&gt;
&lt;div style=&quot;background-color: whitesmoke; border: 0px; color: #373737; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 26px; margin-bottom: 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.red-team-design.com/wp-content/uploads/2011/09/slick-login-form-with-html5-css3-demo.html&quot; style=&quot;border: 0px; color: #1982d1; font-family: inherit; font-style: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;aligncenter size-full wp-image-3425&quot; height=&quot;330&quot; src=&quot;http://www.red-team-design.com/wp-content/uploads/2011/09/login-form-final-result.png&quot; style=&quot;border: 1px solid rgb(221, 221, 221); clear: both; display: block; height: auto; margin: 0.4em auto 1.625em; max-width: 97.5%; padding: 6px; width: auto;&quot; title=&quot;Login form - final result&quot; width=&quot;600&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h3 style=&quot;background-color: whitesmoke; border: 0px; clear: both; color: #373737; font-family: &#39;PT Sans Narrow&#39;, Calibri, &#39;Myriad Pro&#39;, Tahoma, Arial; font-size: 15px; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; text-transform: uppercase; vertical-align: baseline;&quot;&gt;
CONCLUSION&lt;/h3&gt;
&lt;div style=&quot;background-color: whitesmoke; border: 0px; color: #373737; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 26px; margin-bottom: 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
This login form looks very well also on older browsers, as you can see below:&lt;/div&gt;
&lt;div style=&quot;background-color: whitesmoke; border: 0px; color: #373737; font-family: &#39;Helvetica Neue&#39;, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 26px; margin-bottom: 1.625em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;img alt=&quot;&quot; class=&quot;aligncenter size-full wp-image-3428&quot; height=&quot;330&quot; src=&quot;http://www.red-team-design.com/wp-content/uploads/2011/09/login-form-final-result-ie8.png&quot; style=&quot;border: 1px solid rgb(221, 221, 221); clear: both; display: block; height: auto; margin: 0.4em auto 1.625em; max-width: 97.5%; padding: 6px; width: auto;&quot; title=&quot;Login form final result - IE8&quot; width=&quot;600&quot; /&gt;&lt;br /&gt;
&lt;em style=&quot;border: 0px; font-family: inherit; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Internet Explorer 8 screenshot.&lt;/em&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/7089377752189781306/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/12/slick-login-form-with-html5-css3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/7089377752189781306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/7089377752189781306'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/12/slick-login-form-with-html5-css3.html' title='Slick login form with HTML5 &amp; CSS3'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-6059954371738996399</id><published>2013-12-26T07:05:00.001-08:00</published><updated>2013-12-26T07:06:03.011-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="5"/><category scheme="http://www.blogger.com/atom/ns#" term="Best"/><category scheme="http://www.blogger.com/atom/ns#" term="Coding"/><category scheme="http://www.blogger.com/atom/ns#" term="for"/><category scheme="http://www.blogger.com/atom/ns#" term="Sites"/><category scheme="http://www.blogger.com/atom/ns#" term="Tutorials"/><title type='text'> 5 Best Sites for Coding Tutorials</title><content type='html'>&lt;div class=&quot;thumbnail &quot; style=&quot;background-color: white; color: #222222; display: inline-block; float: left; font-family: Arial; font-size: 14px; line-height: 18px; margin: 0px; padding: 5px 22px 10px 0px; text-align: justify; width: 252px;&quot;&gt;
&lt;img alt=&quot;post_image171212_2&quot; class=&quot;attachment-post-thumb wp-post-image&quot; height=&quot;252&quot; src=&quot;http://blog.conduit.com/wp-content/uploads/2012/12/post_image171212_2.jpg&quot; style=&quot;border: none;&quot; width=&quot;246&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: Arial; font-size: 14px; line-height: 19px; padding: 0px 0px 21px; text-align: justify;&quot;&gt;
Do you wish you could create the next Angry Birds, but don’t know the first thing about apps? Do you want to design your own incredible website, but still have to Google the definition of HTML?&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: Arial; font-size: 14px; line-height: 19px; padding: 0px 0px 21px; text-align: justify;&quot;&gt;
Thank goodness we have the Internet. In the last few years, several sites have been popping up across the web to teach us the basics of coding.&lt;span id=&quot;more-10507&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: Arial; font-size: 14px; line-height: 19px; padding: 0px 0px 21px; text-align: justify;&quot;&gt;
Here are five of the best coding tutorial websites, to get you started with programming 101.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: Arial; font-size: 14px; line-height: 19px; padding: 0px 0px 21px; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: Arial; font-size: 14px; line-height: 19px; padding: 0px 0px 21px; text-align: justify;&quot;&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: Arial; font-size: 14px; line-height: 19px; padding: 0px 0px 21px; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ol style=&quot;background-color: white; color: #222222; font-family: Arial; font-size: 14px; line-height: 18px; margin: 0px; padding: 0px 0px 12px 20px; text-align: justify;&quot;&gt;
&lt;li style=&quot;margin: 0px; padding: 0px 0px 18px;&quot;&gt;&lt;strong&gt;For the social coder:&lt;/strong&gt;&amp;nbsp;&lt;a href=&quot;http://www.codecademy.com/&quot; style=&quot;color: #10b5ec; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;Codeacademy&lt;/a&gt;&lt;em&gt;JavaScript, HTML/CSS, Python, Ruby&lt;/em&gt;Codeacademy, perhaps the most famous of the coding tutorial sites, is great for the coder who’s still unsure about the whole thing. It’s super easy (and addictive). You earn badges that you can post to social media sites, much like in a game. If you’re competitive, you can keep track of your friends’ scores and compare your progress. Overall, Codeacademy offers a well-rounded coding education that’s free and very simple to use, which explains why it’s so popular – even New York City Mayor Michael Bloomberg is on the site.&lt;/li&gt;
&lt;li style=&quot;margin: 0px; padding: 0px 0px 18px;&quot;&gt;&lt;strong&gt;For impatient learners:&lt;/strong&gt;&amp;nbsp;&lt;a href=&quot;http://www.learnstreet.com/cg/simple/projects/javascript&quot; style=&quot;color: #10b5ec; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;LearnStreet&lt;/a&gt;&lt;em&gt;JavaScript, Python, Ruby&lt;/em&gt;If you can’t stand all that “build a solid foundation” stuff they taught you in school and you want to see your code&amp;nbsp;&lt;em&gt;doing&amp;nbsp;&lt;/em&gt;things right away – LearnStreet’s a great place to start. You’ll still get all the basics, but you’ll also get hands-on practice in the&amp;nbsp;&lt;a href=&quot;http://www.learnstreet.com/cg/simple/projects/javascript&quot; style=&quot;color: #10b5ec; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;Code Garage&lt;/a&gt;&amp;nbsp;section of the site. Build something as simple as Minesweeper or show off a from-scratch game of blackjack. You can go solo on your projects, or collaborate with your friends. Bonus: Get hints and tips, chat, and tweet with actual programmers.&lt;/li&gt;
&lt;li style=&quot;margin: 0px; padding: 0px 0px 18px;&quot;&gt;&lt;strong&gt;For the indie programmer:&amp;nbsp;&lt;/strong&gt;&lt;a href=&quot;http://www.hackety.com/&quot; style=&quot;color: #10b5ec; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;Hackety Hack&amp;nbsp;&lt;/a&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;em&gt;Ruby&lt;/em&gt;Sometimes you have to start small. Hackety Hack is a beautiful site that teaches you the Ruby programming language – basically, the “Feng Shui” of coding languages. Hackety Hack is simple, streamlined, and easy to use. The site features their top picks of user designs (right now, Connect Four and Calendar), and a blog geared toward fledgling developers. Our advice? Get on the site before everyone’s using it and it’s no longer cool.&lt;/li&gt;
&lt;li style=&quot;margin: 0px; padding: 0px 0px 18px;&quot;&gt;&lt;strong&gt;For video tutorials&lt;/strong&gt;:&amp;nbsp;&amp;nbsp;&lt;a href=&quot;http://www.codehs.com/&quot; style=&quot;color: #10b5ec; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;Codehs&lt;/a&gt;&lt;em&gt;JavaScript, Objective C, Ruby, Python, Etc.&lt;/em&gt;Codehs is designed for high school students, but it’s open to all. The team who developed the site has been teaching at Stanford for the last three years. Start with a free trial, and watch videos that will help you fully understand what you’re writing. Membership is initially free (videos and basic code) and goes up to premium ($75/month). According to the site, you’ll learn JavaScript and get the programming experience needed to pick up any programming language, such as Objective C, Ruby, Python, Java, C, and C++. If you’re thinking about programming as a career, this might be the way to go.&lt;/li&gt;
&lt;li style=&quot;margin: 0px; padding: 0px 0px 18px;&quot;&gt;&lt;strong&gt;For the one who wants to know it all:&lt;/strong&gt;&amp;nbsp;&lt;a href=&quot;http://www.w3schools.com/&quot; style=&quot;color: #10b5ec; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;w3schools&lt;/a&gt;&lt;em&gt;Virtually Everything&lt;/em&gt;Not only does w3schools offer all the fundamental coding languages, from Javascript to HTML/CSS to ASP.NET, it also offers the server side of coding. Learn PHP, SQL, ASP, and ADO. And that’s just the beginning. If you’re looking for fast, free, extensive coding tutorials, w3schools is a must-see.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: Arial; font-size: 14px; line-height: 19px; padding: 0px 0px 21px; text-align: justify;&quot;&gt;
If these five great sites don’t meet your needs, remember that everyone’s favorite online education center,&amp;nbsp;&lt;a href=&quot;http://www.khanacademy.org/&quot; style=&quot;color: #10b5ec; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;Khan Academy&lt;/a&gt;, now offers coding lessons. If you prefer to learn with distinguished professors, you can always take an online course in computer science at one of the new university-powered online educations hubs, such as&amp;nbsp;&lt;a href=&quot;https://www.coursera.org/&quot; style=&quot;color: #10b5ec; text-decoration: none;&quot; target=&quot;_blank&quot;&gt;Coursera&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #222222; font-family: Arial; font-size: 14px; line-height: 19px; padding: 0px 0px 21px; text-align: justify;&quot;&gt;
In other words, the resources are there. No more excuses. Get coding.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/6059954371738996399/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/12/5-best-sites-for-coding-tutorials.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/6059954371738996399'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/6059954371738996399'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/12/5-best-sites-for-coding-tutorials.html' title=' 5 Best Sites for Coding Tutorials'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-6817746925749852598</id><published>2013-12-25T16:42:00.004-08:00</published><updated>2013-12-25T16:43:45.032-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP 101 (part 14): No News is Good News"/><title type='text'>PHP 101 (part 14): No News is Good News</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s1600/php_mysql_logo.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;185&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s320/php_mysql_logo.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/h2&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
A Difficult Choice&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
After the workout I gave you last time, you’re probably either chomping at the&lt;br /&gt;
bit to build another PHP application or you’ve decided to give up PHP programming&lt;br /&gt;
and try growing cucumbers instead. If it’s the latter, you should stop reading&lt;br /&gt;
right now, because I can guarantee you that this concluding installment of&lt;br /&gt;
PHP 101 has absolutely nothing to teach you about vegetable farming.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If it’s the former, however, then you’re going to enjoy what’s coming up. Over the&lt;br /&gt;
next few pages, I’m going to be building a simple&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;RSS news aggregator&lt;/b&gt;&amp;nbsp;using&lt;br /&gt;
PHP, SQLite and SimpleXML. With this news aggregator, you can plug into RSS news&lt;br /&gt;
feeds from all over the web, creating a newscast that reflects your needs and&lt;br /&gt;
interests for your website. The best part: it updates itself automatically with&lt;br /&gt;
the latest stories every time you view it!&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Come on in, and let’s get this show on the road!&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading2&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Alphabet Soup&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
I’ll start with the basics. What the heck is RSS anyhow?&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
RSS (the acronym stands for RDF Site Summary) is a format originally devised&lt;br /&gt;
by Netscape to distribute information about the content on its My.Netscape.Com&lt;br /&gt;
portal. The format has gone through many iterations since its introduction in&lt;br /&gt;
early 1997 (take a look at&amp;nbsp;&lt;a href=&quot;http://backend.userland.com/stories/rss091&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://backend.userland.com/stories/rss091&lt;/a&gt;&amp;nbsp;for information on RSS’s&lt;br /&gt;
long and complicated history) but most feeds use RSS 1.0 or RSS 0.91, both of&lt;br /&gt;
which are lightweight yet full-featured.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
RSS makes it possible for webmasters to publish and distribute information about&lt;br /&gt;
what’s new and interesting on a particular site at a particular time. This&lt;br /&gt;
information, which could range from a list of news articles to stock market&lt;br /&gt;
data or weather forecasts, is published as a well-formed XML document, and can&lt;br /&gt;
therefore be parsed, processed and rendered by any XML parser – including the&lt;br /&gt;
SimpleXML parser that is part of PHP 5.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Quite a few popular web sites make an RSS or RDF news feed available to the public at&lt;br /&gt;
large.&amp;nbsp;&lt;a href=&quot;http://www.freshmeat.net/&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;Freshmeat&lt;/a&gt;&amp;nbsp;and&lt;br /&gt;
&lt;a href=&quot;http://www.slashdot.org/slashdot.rdf&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;Slashdot&lt;/a&gt;&amp;nbsp;both have&lt;br /&gt;
one, and so do many others, including the&amp;nbsp;&lt;a href=&quot;http://pear.php.net/feeds/&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;&amp;lt;br&quot;&gt;&quot;_blank&quot;&amp;gt;PEAR&lt;/a&gt;,&amp;nbsp;&lt;a href=&quot;http://pecl.php.net/feeds/&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;PECL&lt;/a&gt;&amp;nbsp;and&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.zend.com/zend_rss.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;Zend&lt;/a&gt;&amp;nbsp;sites. A quick Google search&lt;br /&gt;
for&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public RSS feeds&lt;/b&gt;&amp;nbsp;will get you more links than you can shake a stick at.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
An RSS document typically contains a list of resources (URLs), marked up with&lt;br /&gt;
descriptive metadata. Here’s an example:&lt;/div&gt;
&lt;table class=&quot;tutorialExample&quot; style=&quot;background-color: white; border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(230, 230, 230); color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 1.2em; outline: 0px; padding: 0px; vertical-align: baseline; width: 541px;&quot;&gt;&lt;tbody style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;tr style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background-color: transparent; border: 1px solid rgb(230, 230, 230); margin: 0px; outline: 0px; padding: 6px 0px 3px 10px; vertical-align: baseline;&quot;&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;br /&gt;&amp;lt;rdf:RDF xmlns:rdf=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#&quot; xmlns=&quot;http://purl.org/rss/1.0/&quot;&amp;gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;channel rdf:about=&quot;http://www.melonfire.com/&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;title&amp;gt;Trog&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;description&amp;gt;Well-written technical articles and tutorials on web technologies&amp;lt;/description&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;link&amp;gt;http://www.melonfire.com/community/columns/trog/&amp;lt;/link&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;items&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;rdf:Seq&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;li rdf:resource=&quot;http://www.melonfire.com/community/columns/trog/article.php?id=100&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;li rdf:resource=&quot;http://www.melonfire.com/community/columns/trog/article.php?id=71&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;li rdf:resource=&quot;http://www.melonfire.com/community/columns/trog/article.php?id=62&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/rdf:Seq&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;/items&amp;gt;&lt;br /&gt;
&amp;lt;/channel&amp;gt;&lt;br /&gt;
&amp;lt;item rdf:about=&quot;http://www.melonfire.com/community/columns/trog/article.php?id=100&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;title&amp;gt;Building A PHP-Based Mail Client (part 1)&amp;lt;/title&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;link&amp;gt;http://www.melonfire.com/community/columns/trog/article.php?id=100&amp;lt;/link&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;description&amp;gt;Ever wondered how web-based mail clients work? Find out here.&amp;lt;/description&amp;gt;&lt;br /&gt;
&amp;lt;/item&amp;gt;&lt;br /&gt;
&amp;lt;item rdf:about=&quot;http://www.melonfire.com/community/columns/trog/article.php?id=71&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;title&amp;gt;Using PHP With XML (part 1)&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;link&amp;gt;http://www.melonfire.com/community/columns/trog/article.php?id=71&amp;lt;/link&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;description&amp;gt;Use PHP&#39;s SAX parser to parse XML data and generate HTML pages.&amp;lt;/description&amp;gt;&lt;br /&gt;
&amp;lt;/item&amp;gt;&lt;br /&gt;
&amp;lt;item rdf:about=&quot;http://www.melonfire.com/community/columns/trog/article.php?id=62&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;title&amp;gt;Access Granted&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;link&amp;gt;http://www.melonfire.com/community/columns/trog/article.php?id=62&amp;lt;/link&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;lt;description&amp;gt;Precisely control access to information with the SQLite grant tables.&amp;lt;/description&amp;gt;&lt;/div&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/item&amp;gt;&lt;br /&gt;&amp;lt;/rdf:RDF&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
As you can see, an&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;RDF file&lt;/b&gt;&amp;nbsp;is split up into clearly demarcated sections. First&lt;br /&gt;
comes the document&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;prolog&lt;/b&gt;,&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;namespace declarations&lt;/b&gt;, and&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;root element&lt;/b&gt;.&lt;br /&gt;
This is followed by a&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;channel&amp;gt;&lt;/code&gt;&amp;nbsp;block, which contains general&lt;br /&gt;
information on the&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;channel&lt;/b&gt;&amp;nbsp;that is described by this RDF file. In the example&lt;br /&gt;
above, the channel is Melonfire’s Trog column, which gets updated every week with new&lt;br /&gt;
technical articles and tutorials.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;channel&amp;gt;&lt;/code&gt;&amp;nbsp;block contains an&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;items&amp;gt;&lt;/code&gt;&amp;nbsp;block,&lt;br /&gt;
which contains a sequential list of all the resources described within the RDF document.&lt;br /&gt;
Every resource in this block corresponds to a resource described in greater detail in a&lt;br /&gt;
subsequent&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;item&amp;gt;&lt;/code&gt;&amp;nbsp;block. Every&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;item&amp;gt;&lt;/code&gt;&amp;nbsp;block&lt;br /&gt;
describes a single resource in greater detail, providing a title, an URL and a description&lt;br /&gt;
of that resource. It’s this information that our application will use to generate a&lt;br /&gt;
personalized news feed.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading3&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Laying the Foundation&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Now that you know what RSS and RDF are all about, it’s time to start work. I’ll begin by&lt;br /&gt;
sitting down at a table near the window and doodling aimlessly on a sheet of paper until&lt;br /&gt;
I figure out exactly what my application is supposed to do, piece by piece (actually, in&lt;br /&gt;
this case, the&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;requirements&lt;/b&gt;&amp;nbsp;are actually pretty basic):&lt;/div&gt;
&lt;ol style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; list-style: none; margin: 0px 0px 1.5em; outline: 0px; padding: 0px 0px 0px 30px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;The application must support one or more RSS-compliant news feeds. On start-up, the&lt;br /&gt;application should retrieve the latest versions of these feeds, parse them and display&lt;br /&gt;their contents in an easy-to-read manner. A SQLite database is a good choice to store&lt;br /&gt;this list of feeds.&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;The user should be able to control the number of stories s/he picks up from each&lt;br /&gt;feed. For example, a user might want to display more science and health news than&lt;br /&gt;business news.&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;The application should offer the user a web-based interface to add or delete news&lt;br /&gt;feeds. This interface will use PHP’s SQLite API to run appropriate SQL queries on the&lt;br /&gt;SQLite database file and alter the information stored in the database.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Keeping these requirements in mind, it’s possible to&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;design a simple database&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
table to hold the (user-configurable) list of RSS news feeds. Here’s what it might&lt;br /&gt;
look like:&lt;/div&gt;
&lt;blockquote style=&quot;background-color: white; border-left-color: rgb(119, 119, 119); border-left-style: solid; border-width: 0px 0px 0px 2px; color: #777777; font-family: sans-serif; font-size: 14px; font-style: italic; line-height: 21px; margin: 5px auto 15px; outline: 0px; padding: 0px 10px; quotes: none; vertical-align: baseline; width: 460.6875px;&quot;&gt;
&lt;pre style=&quot;background-color: transparent; border: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;CREATE TABLE rss (
  id INTEGER NOT NULL PRIMARY KEY,
  title varchar(255) NOT NULL,
  url varchar(255) NOT NULL,
  count INTEGER NOT NULL
);
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
From the table above, it’s clear that every news feed will have three attributes: a&lt;br /&gt;
descriptive title, the URL to the feed itself, and a value indicating how many of the&lt;br /&gt;
stories in the feed you would like to see displayed in your own custom news page.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Let’s add some data to get things started:&lt;/div&gt;
&lt;blockquote style=&quot;background-color: white; border-left-color: rgb(119, 119, 119); border-left-style: solid; border-width: 0px 0px 0px 2px; color: #777777; font-family: sans-serif; font-size: 14px; font-style: italic; line-height: 21px; margin: 5px auto 15px; outline: 0px; padding: 0px 10px; quotes: none; vertical-align: baseline; width: 460.6875px;&quot;&gt;
&lt;pre style=&quot;background-color: transparent; border: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;INSERT INTO rss VALUES(1, &#39;Slashdot&#39;, &#39;http://slashdot.org/slashdot.rdf&#39;, 5);
INSERT INTO rss VALUES(2, &#39;Wired News&#39;, &#39;http://www.wired.com/news_drop/netcenter/netcenter.rdf&#39;, 5);
INSERT INTO rss VALUES(3, &#39;Business News&#39;, &#39;http://www.npr.org/rss/rss.php?topicId=6&#39;, 3);
INSERT INTO rss VALUES(4, &#39;Health News&#39;,
                          &#39;http://news.bbc.co.uk/rss/newsonline_world_edition/health/rss091.xml&#39;, 3);
INSERT INTO rss VALUES(5, &#39;Freshmeat&#39;, &#39;http://www.freshmeat.net/backend/fm-releases.rdf&#39;, 5);
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You can create all this directly from the&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;schema&lt;/b&gt;&amp;nbsp;file&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;rss.sql&lt;/i&gt;&amp;nbsp;using the SQLite&lt;br /&gt;
command&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.read&lt;/code&gt;&amp;nbsp;from the command-line client, if you still have that on board&lt;br /&gt;
from&amp;nbsp;&lt;a href=&quot;http://devzone.zend.com/24/php-101-part-15-no-news-is-good-news/php101-9.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;Part Nine&lt;/a&gt;. In fact, now would be a good time for you to&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://devzone.zend.com/24/php-101-part-15-no-news-is-good-news/php101-15.zip&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;download all the source code&lt;/a&gt;&amp;nbsp;for this application, so that&lt;br /&gt;
you can check it out and refer to it easily throughout this tutorial. Note that you will&lt;br /&gt;
need a PHP 5-enabled web server to run this code.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading4&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Top Story&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
With the database safely in its web-inaccessible directory, the next step is to write&lt;br /&gt;
the code that uses the data inside it to connect to each news feed, parse it for news&lt;br /&gt;
data, and present a customized news page.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s what that code,&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;user.php&lt;/i&gt;, looks like:&lt;/div&gt;
&lt;table class=&quot;tutorialExample&quot; style=&quot;background-color: white; border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(230, 230, 230); color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 1.2em; outline: 0px; padding: 0px; vertical-align: baseline; width: 541px;&quot;&gt;&lt;tbody style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;tr style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background-color: transparent; border: 1px solid rgb(230, 230, 230); margin: 0px; outline: 0px; padding: 6px 0px 3px 10px; vertical-align: baseline;&quot;&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 5&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// include configuration file&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;include(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;config.php&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open database file&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-open.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_open&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;ERROR: Unable to open database!&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// generate and execute query&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT id, title, url, count FROM rss&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-query.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ERROR: $query. &quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-error-string.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_error_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-last-error.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_last_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if records present&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-num-rows.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_num_rows&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// iterate through resultset&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// fetch and parse feed&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;while(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-fetch-object.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_fetch_object&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.simplexml-load-file.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;simplexml_load_file&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;url&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;h4&amp;gt;$row-&amp;gt;title&amp;lt;/h4&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print descriptions&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;for (&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$x&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$x&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;count&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$x&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;++) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// for RSS 0.91&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (isset(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;channel&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;item&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$item&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;channel&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;item&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$x&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// for RSS 1.0&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;elseif (isset(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;item&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$item&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;item&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$x&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;a href=\&quot;$item-&amp;gt;link\&quot;&amp;gt;$item-&amp;gt;title&amp;lt;/a&amp;gt;&amp;lt;br /&amp;gt;$item-&amp;gt;description&amp;lt;p /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;hr /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// reset variables&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;unset(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;unset(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$item&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
}&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if no records present&lt;br /&gt;// display message&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;else {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;font size = &#39;-1&#39;&amp;gt;No feeds currently configured&amp;lt;/font&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close connection&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-close.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_close&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s what the output might look like (note that there will a time lag in producing&lt;br /&gt;
the page, because PHP will be silently opening HTTP connections to each URL to retrieve&lt;br /&gt;
the corresponding RSS feed):&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;img alt=&quot;output&quot; border=&quot;0&quot; src=&quot;http://devzone.zend.com/images/articles/vikram15-1.jpg&quot; style=&quot;background-color: #f8f8f4; border: 1px solid rgb(230, 230, 230); margin: 0px 0px 10px; outline: 0px; padding: 2px; vertical-align: baseline;&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The code to accomplish this might look simple, but there’s actually a lot going on behind&lt;br /&gt;
the scenes. The first step is to obtain a list of the RSS feeds configured by the user&lt;br /&gt;
from the SQLite database. To accomplish this, a SQLite database handle is initialized, and&lt;br /&gt;
a SQL&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SELECT&lt;/code&gt;&amp;nbsp;query is executed. A&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;while()&lt;/code&gt;&amp;nbsp;loop is used to iterate&lt;br /&gt;
through the resulting record collection.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
For each URL thus obtained, the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;simplexml_load_file()&lt;/code&gt;&amp;nbsp;function is used to&lt;br /&gt;
retrieve and read the RSS feed. Depending on the number of stories to be displayed, a&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;for()&lt;/code&gt;&amp;nbsp;loop is executed and the appropriate number of&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;item&amp;gt;&lt;/code&gt;&lt;br /&gt;
elements in the feed are parsed. Notice that the path to access an&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;item&amp;gt;&lt;/code&gt;&lt;br /&gt;
differs depending on whether the feed is RSS 0.91 or RSS 1.0.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Note that if the database is empty, an error message will appear. In this example,&lt;br /&gt;
since I’ve already inserted a bunch of records into the database, you’ll never see&lt;br /&gt;
the error message at all; however, it’s good programming practice to ensure that all&lt;br /&gt;
eventualities are accounted for, even remote ones.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
As before, the file&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;config.php&lt;/i&gt;&amp;nbsp;is included at the top of every script. This file&lt;br /&gt;
contains database access parameters, as below:&lt;/div&gt;
&lt;table class=&quot;tutorialExample&quot; style=&quot;background-color: white; border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(230, 230, 230); color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 1.2em; outline: 0px; padding: 0px; vertical-align: baseline; width: 541px;&quot;&gt;&lt;tbody style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;tr style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background-color: transparent; border: 1px solid rgb(230, 230, 230); margin: 0px; outline: 0px; padding: 6px 0px 3px 10px; vertical-align: baseline;&quot;&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// database details&lt;br /&gt;// always use a directory that cannot be accessed from the web&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$path&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;DOCUMENT_ROOT&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;/../&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$path&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;rss.db&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading5&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Point and Click&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
With the news display out of the way, all that’s left is to add a simple administrative&lt;br /&gt;
tool to manipulate the contents of the SQLite database. The code here is going to be&lt;br /&gt;
very similar to what you saw in&amp;nbsp;&lt;a href=&quot;http://devzone.zend.com/24/php-101-part-15-no-news-is-good-news/php101-14.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;PHP 101 Part 14&lt;/a&gt;: a start&lt;br /&gt;
page called&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;admin.php&lt;/i&gt;&amp;nbsp;that provides a snapshot of the current database, and a&lt;br /&gt;
form to add new entries. Here it is in full:&lt;/div&gt;
&lt;table class=&quot;tutorialExample&quot; style=&quot;background-color: white; border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(230, 230, 230); color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 1.2em; outline: 0px; padding: 0px; vertical-align: baseline; width: 541px;&quot;&gt;&lt;tbody style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;tr style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background-color: transparent; border: 1px solid rgb(230, 230, 230); margin: 0px; outline: 0px; padding: 6px 0px 3px 10px; vertical-align: baseline;&quot;&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;basefont face = &#39;Arial&#39;&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;h2&amp;gt;Feed Manager&amp;lt;/h2&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;h4&amp;gt;Current Feeds:&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;table border = &#39;0&#39; cellspacing = &#39;10&#39;&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 5&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// include configuration file&lt;br /&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;include(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;config.php&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open database file&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-open.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_open&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;ERROR: Unable to open database!&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// generate and execute query&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT id, title, url, count FROM rss&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-query.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ERROR: $query. &quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-error-string.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_error_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-last-error.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_last_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if records present&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-num-rows.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_num_rows&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// iterate through result set&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// print article titles&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;while (&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-fetch-object.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_fetch_object&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;td&amp;gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;nbsp;(&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;count&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;)&amp;lt;/td&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;td&amp;gt;&amp;lt;font size = &#39;-2&#39;&amp;gt;&amp;lt;a href=&quot;delete.php?id=&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&quot;&amp;gt;delete&amp;lt;/a&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/tr&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if there are no records present, display message&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;else {&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;font size = &#39;-1&#39;&amp;gt;No feeds currently configured&amp;lt;/font&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close connection&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-close.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_close&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;/table&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;h4&amp;gt;Add New Feed:&amp;lt;/h4&amp;gt;&lt;br /&gt;
&amp;lt;form action = &#39;add.php&#39; method = &#39;post&#39;&amp;gt;&lt;br /&gt;
&amp;lt;table border = &#39;0&#39; cellspacing = &#39;5&#39;&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;td&amp;gt;Title&amp;lt;/td&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;td&amp;gt;&amp;lt;input type = &#39;text&#39; name = &#39;title&#39;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;td&amp;gt;Feed URL&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;td&amp;gt;&amp;lt;input type = &#39;text&#39; name = &#39;url&#39;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;td&amp;gt;Stories to display&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;td&amp;gt;&amp;lt;input type = &#39;text&#39; name = &#39;count&#39; size = &#39;2&#39;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;td colspan = &#39;2&#39; align = &#39;right&#39;&amp;gt;&amp;lt;input type = &#39;submit&#39; name = &#39;submit&#39; value = &#39;Add RSS Feed&#39;&amp;gt;&amp;lt;/td&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;/div&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s what it looks like:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;img alt=&quot;admin.php&quot; border=&quot;0&quot; src=&quot;http://devzone.zend.com/images/articles/vikram15-2.jpg&quot; style=&quot;background-color: #f8f8f4; border: 1px solid rgb(230, 230, 230); margin: 0px 0px 10px; outline: 0px; padding: 2px; vertical-align: baseline;&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
As you can see, there are two sections in this script. The first half connects to the&lt;br /&gt;
database and prints a list of all the currently configured news feeds, with a “delete”&lt;br /&gt;
link next to each. The second half contains a form for the administrator to add a new&lt;br /&gt;
feed, together with its attributes.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Once the form is submitted, the data gets&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;POST&lt;/code&gt;-ed to the script&lt;br /&gt;
&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;add.php&lt;/i&gt;, which validates it and saves it to the database. Here’s the code for&lt;br /&gt;
&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;add.php&lt;/i&gt;:&lt;/div&gt;
&lt;table class=&quot;tutorialExample&quot; style=&quot;background-color: white; border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(230, 230, 230); color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 1.2em; outline: 0px; padding: 0px; vertical-align: baseline; width: 541px;&quot;&gt;&lt;tbody style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;tr style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background-color: transparent; border: 1px solid rgb(230, 230, 230); margin: 0px; outline: 0px; padding: 6px 0px 3px 10px; vertical-align: baseline;&quot;&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&amp;lt;basefont face = &#39;Arial&#39;&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;h2&amp;gt;Feed Manager&amp;lt;/h2&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 5&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (isset(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;submit&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check form input for errors&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// check title&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.trim.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;trim&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;title&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) ==&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die(&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;ERROR: Please enter a title&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check URL&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if ((&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.trim.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;trim&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;url&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) ==&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) || !&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.ereg.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;ereg&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;^http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\._\?\,\&#39;/\\\+&amp;amp;%\$#\=~\-])*$&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;url&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die(&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;ERROR: Please enter a valid URL&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check story number&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.is-numeric.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;is_numeric&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;count&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die(&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;ERROR: Please enter a valid story count&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// include configuration file&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;include(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;config.php&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open database file&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-open.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_open&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;ERROR: Unable to open database!&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// generate and execute query&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;INSERT INTO rss (title, url, count) VALUES (&#39;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;title&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&#39;, &#39;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;url&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&#39;, &#39;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;count&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&#39;)&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-query.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ERROR: $query. &quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-error-string.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_error_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-last-error.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_last_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close connection&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-close.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_close&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print success message&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Item successfully added to the database! Click &amp;lt;a href = &#39;admin.php&#39;&amp;gt;here&amp;lt;/a&amp;gt; to return to the main page&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die(&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;ERROR: Data not correctly submitted&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The lower half of the script should be familiar to you: it contains the usual function&lt;br /&gt;
calls to open an SQLite database and execute an&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;INSERT&lt;/code&gt;&amp;nbsp;query to save the&lt;br /&gt;
user’s data to the database. What’s interesting, though, is the top half of the script,&lt;br /&gt;
which contains a number of input tests to ensure that the data being saved doesn’t&lt;br /&gt;
contain gibberish.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
There are three tests here. One checks for the presence of a descriptive title, another&lt;br /&gt;
uses the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;is_numeric()&lt;/code&gt;&amp;nbsp;function to verify that the value entered for the&lt;br /&gt;
story count is a valid number, and the third uses the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ereg()&lt;/code&gt;&amp;nbsp;function to&lt;br /&gt;
check the format of the URL. If you read&amp;nbsp;&lt;a href=&quot;http://devzone.zend.com/article/661&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;Part 13&lt;/a&gt;, you’ll&lt;br /&gt;
know all about the importance of validating user input; here’s that theory going into&lt;br /&gt;
action.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
That takes care of adding new RSS feeds. Now, what about removing them?&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Remember how, in&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;admin.php&lt;/i&gt;, each feed displayed in the list had a “delete” link,&lt;br /&gt;
which pointed to the script&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;delete.php&lt;/i&gt;. This&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;delete.php&lt;/i&gt;&amp;nbsp;script takes care&lt;br /&gt;
of deleting a news feed from the table, given the feed ID (which is passed through the&lt;br /&gt;
link). Take a look at the code, and things will become clearer:&lt;/div&gt;
&lt;table class=&quot;tutorialExample&quot; style=&quot;background-color: white; border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(230, 230, 230); color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin: 0px 0px 1.2em; outline: 0px; padding: 0px; vertical-align: baseline; width: 541px;&quot;&gt;&lt;tbody style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;tr style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background-color: transparent; border: 1px solid rgb(230, 230, 230); margin: 0px; outline: 0px; padding: 6px 0px 3px 10px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;basefont face = &#39;Arial&#39;&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;h2&amp;gt;Feed Manager&amp;lt;/h2&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 5&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (isset(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_GET&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;id&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) &amp;amp;&amp;amp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.is-numeric.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;is_numeric&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_GET&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;id&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// include configuration file&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;include(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;config.php&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open database file&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-open.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_open&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;ERROR: Unable to open database!&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// generate and execute query&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;DELETE FROM rss WHERE id = &#39;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_GET&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;id&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&#39;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-query.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ERROR: $query. &quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-error-string.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_error_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-last-error.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_last_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close connection&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-close.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_close&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print success message&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Item successfully removed from the database! Click &amp;lt;a href = &#39;admin.php&#39;&amp;gt;here&amp;lt;/a&amp;gt; to return to the main page&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;br /&gt;
else {&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die(&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;ERROR: Data not correctly submitted&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The record ID passed through the URL&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;GET&lt;/code&gt;&amp;nbsp;method is retrieved by&lt;br /&gt;
&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;delete.php&lt;/i&gt;, and used with a&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;DELETE&lt;/code&gt;&amp;nbsp;SQL query to erase the&lt;br /&gt;
corresponding record. Try it out and see for yourself!&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/6817746925749852598/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/12/php-101-part-14-no-news-is-good-news.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/6817746925749852598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/6817746925749852598'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/12/php-101-part-14-no-news-is-good-news.html' title='PHP 101 (part 14): No News is Good News'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s72-c/php_mysql_logo.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-3039543535931301109</id><published>2013-12-25T16:33:00.002-08:00</published><updated>2013-12-25T16:36:09.270-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP 101 (part 13): The Trashman Cometh – Part 2"/><title type='text'>PHP 101 (part 13): The Trashman Cometh – Part 2</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s1600/php_mysql_logo.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;185&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s320/php_mysql_logo.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/h2&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
A Regular Guy&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
So far, the validation routines have been fairly simple- checking dates, checking&lt;br /&gt;
for required values, and checking data type or size. Often, however, you need more&lt;br /&gt;
sophisticated validation – for example, to test whether an email address or telephone&lt;br /&gt;
number is written in the correct format. To accomplish these more complex validation&lt;br /&gt;
tasks, clever PHP programmers turn to&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;regular expressions&lt;/b&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Regular expressions, aka&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;regex&lt;/i&gt;, are a powerful tool for&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;pattern matching&lt;br /&gt;and substitution&lt;/b&gt;. They are commonly associated with almost all UNIX-based tools,&lt;br /&gt;
including editors like vi, scripting languages like Perl and PHP, and shell programs&lt;br /&gt;
like awk and sed. You’ll even find them in client-side scripting languages like&lt;br /&gt;
JavaScript. Kinda like Madonna, their popularity cuts across languages and territorial&lt;br /&gt;
boundaries.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
A regular expression lets you build patterns using a set of special characters. These&lt;br /&gt;
patterns can then be compared with text in a file, data entered into an application,&lt;br /&gt;
or input from a form filled in by users on a web site. Depending on whether or not&lt;br /&gt;
there’s a match, appropriate program code can be executed. Regular expressions thus&lt;br /&gt;
play an important role in the decision-making routines of web applications.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
A regular expression can be as simple as this:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/love/&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
All this does is match the pattern&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;love&lt;/i&gt;&amp;nbsp;in the text it’s applied to. Like many&lt;br /&gt;
other things in life, it’s simpler to get your mind around the pattern than the concept&lt;br /&gt;
- but that’s neither here nor there.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
How about something a little more complex? The pattern&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/fo+/&lt;/code&gt;&amp;nbsp;would match&lt;br /&gt;
the words&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fool&lt;/i&gt;,&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;footsie&lt;/i&gt;&amp;nbsp;and&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;four-seater&lt;/i&gt;. Try it:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
$array&amp;nbsp;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= array(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;fool&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;footsie&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;four-seater&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
foreach (&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$array&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$element&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.preg-match.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;preg_match&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;/fo+/&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$element&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;$element gives a match&amp;lt;br /&amp;gt;\n&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
And although it’s a pretty silly example, you have to admit it’s realistic – after all, who&lt;br /&gt;
but fools in love would play footsie in a four-seater?&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;+&lt;/code&gt;&amp;nbsp;symbol used in the expression is called a&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;metacharacter&lt;/b&gt;&amp;nbsp;– a&lt;br /&gt;
character that has a special meaning when used within a pattern. The&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;+&lt;/code&gt;&lt;br /&gt;
metacharacter is used to match&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;one or more occurrences of the preceding character&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
- in the example above, that would be the letter&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;f&lt;/code&gt;&amp;nbsp;followed by one or more&lt;br /&gt;
occurrences of the letter&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;o&lt;/code&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Similar to the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;+&lt;/code&gt;&amp;nbsp;metacharacter are&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;*&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&lt;/code&gt;, which&lt;br /&gt;
are used to match&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;zero or more occurrences of the preceding character&lt;/b&gt;, and&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;zero or one occurrence of the preceding character&lt;/b&gt;, respectively. So&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/ab*/&lt;/code&gt;&lt;br /&gt;
would match&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;aggressive&lt;/i&gt;,&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;absolutely&lt;/i&gt;&amp;nbsp;and&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;abbey&lt;/i&gt;, while&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/Ron?/&lt;/code&gt;&amp;nbsp;would match&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Ronald&lt;/i&gt;,&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Roger&lt;/i&gt;&amp;nbsp;and&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Roland&lt;/i&gt;, though not&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Rimbaud&lt;/i&gt;&amp;nbsp;or&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Mona&lt;/i&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In case all this seems a little too imprecise, you can also&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;specify a range for the&lt;br /&gt;number of matches&lt;/b&gt;. For example, the regular expression&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/ron{2,6}/&lt;/code&gt;&amp;nbsp;would&lt;br /&gt;
match&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ronny&lt;/i&gt;&amp;nbsp;and&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ronnnnnny!&lt;/i&gt;, but not&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ron&lt;/i&gt;. The numbers in the curly&lt;br /&gt;
braces represent the lower and upper values of the range to match; you can leave out the&lt;br /&gt;
upper limit for an open-ended range match.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Just as you can specify a range for the number of characters to be matched, you can also&lt;br /&gt;
&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;specify a range of characters&lt;/b&gt;. For example, the range&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/[A-Z]/&lt;/code&gt;&amp;nbsp;would match&lt;br /&gt;
any string containing an upper-case alphabetic character, while&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/[a-z]/&lt;/code&gt;&amp;nbsp;would&lt;br /&gt;
match any lowercase letters, and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/[0-9]/&lt;/code&gt;&amp;nbsp;would match all numbers between 0&lt;br /&gt;
and 9.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Using these three character ranges, it’s pretty easy to create a regular expression to&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;match an ordered alphanumeric field&lt;/b&gt;:&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/([a-z][A-Z][0-9])+/&lt;/code&gt;&amp;nbsp;would match&lt;br /&gt;
an alphanumeric string given the same character type order, such as&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;aB2&lt;/i&gt;, but not&lt;br /&gt;
&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;abc&lt;/i&gt;. Note the parentheses around the patterns – contrary to what you might think,&lt;br /&gt;
these are not there purely to confuse you; they come in handy when&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;grouping sections&lt;br /&gt;of a regular expression&lt;/b&gt;&amp;nbsp;together.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Of course, this is just the tip of the regular expression iceberg. There are many more&lt;br /&gt;
metacharacters, and innumerable ways in which they can be combined to create powerful&lt;br /&gt;
pattern-matching rules. For an in-depth introduction, take a look at&lt;a href=&quot;http://www.melonfire.com/community/columns/trog/article.php?id=2&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://www.melonfire.com/community/columns/trog/article.php?id=2&lt;/a&gt;, the&lt;br /&gt;
reference pages at&amp;nbsp;&lt;a href=&quot;http://it.metr.ou.edu/regex/&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://it.metr.ou.edu/regex/&lt;/a&gt;, and the PHP manual pages at&amp;nbsp;&lt;a br=&quot;&quot; href=&quot;http://www.php.net/manual/en/ref.regex.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;target = &#39;_blank&#39;&amp;gt;http://www.php.net/manual/en/ref.regex.php&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a br=&quot;&quot; href=&quot;http://www.php.net/manual/en/ref.pcre.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;target = &#39;_blank&#39;&amp;gt;http://www.php.net/manual/en/ref.pcre.php&lt;/a&gt;. You can find a bunch&lt;br /&gt;
of sample regular expressions for all manner of applications at&lt;a href=&quot;http://devzone.zend.com/21/php-101-part-13-the-trashman-cometh_part-2/%3Cbr&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;&#39;http://www.regexlib.com/&#39; target = &#39;_blank&#39;&amp;gt;http://www.regexlib.com/&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading6&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
A Pattern Emerges&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In PHP, regular expression matching takes place with the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ereg()&lt;/code&gt;&amp;nbsp;or&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;preg_match()&lt;/code&gt;&amp;nbsp;functions (&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ereg()&lt;/code&gt;&amp;nbsp;also comes in a case-insensitive&lt;br /&gt;
version called&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eregi()&lt;/code&gt;). These functions, which differ marginally from each&lt;br /&gt;
other in their semantics, can be used to test user input against pre-defined patterns and&lt;br /&gt;
thus catch invalid data before it gets into your application. The most common example of&lt;br /&gt;
regex usage in PHP is, of course, the email address validator… and since I’m a slave to&lt;br /&gt;
tradition, that’s also my first example. Take a look:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;submit&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;form action = &#39;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php $_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;PHP_SELF&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&#39; method = &#39;post&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Email address:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type = &#39;text&#39; name = &#39;email&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type = &#39;submit&#39; name = &#39;submit&#39; value = &#39;Save&#39;&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;br /&gt;else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check email address&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.ereg.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;ereg&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)*\.([a-zA-Z]{2,6})$&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;email&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die(&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Dunno what that is, but it sure isn&#39;t an email address!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// process the data&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;The email address {$_POST[&#39;email&#39;]} has a valid structure. Doesn&#39;t mean it works!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;}&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here, the pattern&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)*\.([a-zA-Z]{2,6})$/&lt;/code&gt;&lt;br /&gt;
(try saying that fast!) is a regular expression that matches&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;the basic format for a&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;user@host&lt;/code&gt;&amp;nbsp;email address&lt;/b&gt;. Input which matches this pattern&lt;br /&gt;
will be accepted; input which doesn’t will trigger a piercing siren. Notice that&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ereg()&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
doesn’t need the same delimiters as the faster&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;preg_match()&lt;/code&gt;, which complains if it&lt;br /&gt;
doesn’t get a&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/&lt;/code&gt;&amp;nbsp;at each end of the expression.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s another example, this one good for testing&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;international phone numbers&lt;/b&gt;:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;submit&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;form action = &#39;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php $_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;PHP_SELF&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&#39; method = &#39;post&#39;&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Phone number (with country/area codes):&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type = &#39;text&#39; name = &#39;tel&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type = &#39;submit&#39; name = &#39;submit&#39; value = &#39;Save&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;br /&gt;else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check phone number&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.preg-match.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;preg_match&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;/^(\+|00)[1-9]{1,3}(\.|\s|-)?([0-9]{1,5}(\.|\s|-)?){1,3}$/&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;tel&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Dunno what that is, but it sure isn&#39;t an international phone number!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// process the data&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;{$_POST[&#39;tel&#39;]} has a valid structure. Doesn&#39;t mean it works!&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;}&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If you play with this a bit, you’ll see that it’ll accept any of the numbers&lt;br /&gt;
&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;+1.212.1234.4567&lt;/i&gt;,&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;+44 1865 123456&lt;/i&gt;&amp;nbsp;and&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0091 11 1234 5678&lt;/i&gt;… even&lt;br /&gt;
though each is formatted differently. Mostly this is because of my use of the&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;|&lt;/code&gt;&amp;nbsp;separator in the regular expression, which functions as logical&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;OR&lt;/code&gt;&amp;nbsp;and makes it possible to create a pattern that&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;supports alternatives&lt;br /&gt;internally&lt;/b&gt;. Obviously you can tighten the pattern up as necessary. For example, if&lt;br /&gt;
you’re in India and your application only supports Indian phone numbers, you can fix&lt;br /&gt;
the pattern so that it expects&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;91&lt;/code&gt;&amp;nbsp;(India’s country code) as the first&lt;br /&gt;
two digits of the number.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
It’s interesting to try rewriting some of our earlier validation routines using regular&lt;br /&gt;
expressions. Here’s an alternative version of one of the early examples in this tutorial,&lt;br /&gt;
rewritten to use&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ereg()&lt;/code&gt;&amp;nbsp;instead of&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;intval()&lt;/code&gt;,&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;is_numeric()&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isset()&lt;/code&gt;:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;submit&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;form action = &#39;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php $_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;PHP_SELF&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&#39; method = &#39;post&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;How many sandwiches would you like? (min 1, max 9)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type = &#39;text&#39; name = &#39;quantity&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type = &#39;submit&#39; name = &#39;submit&#39; value = &#39;Save&#39;&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;br /&gt;else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check for required data&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.ereg.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;ereg&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;^[1-9]$&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;quantity&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die(&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;ERROR: That is an invalid quantity!&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// process the data&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;I&#39;m making you {$_POST[&#39;quantity&#39;]} sandwiches. Hope you can eat them all!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;}&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Notice how a single regular expression here replaces four separate tests in the earlier&lt;br /&gt;
version, and how much more compact the result is. It’s precisely this power and&lt;br /&gt;
flexibility that make regular expressions such an important part of the input validation&lt;br /&gt;
toolkit.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading7&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Back to Class&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Now that you know the basics of input validation, it should be clear to you that this is&lt;br /&gt;
a task you’ll be performing often. It therefore makes sense to create a reusable&lt;br /&gt;
library of functions for input validation, which you can use every time an application&lt;br /&gt;
needs its input checked for errors. That’s precisely what I’m going to do next -&lt;br /&gt;
create a PHP class that exposes basic object methods for data validation and error&lt;br /&gt;
handling, and then use it to validate a form.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s the class definition,&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class.formValidator.php&lt;/i&gt;, written for PHP 5. You could&lt;br /&gt;
adapt it to PHP 4 by simply getting rid of the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;private&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
markers on the class methods and making the private&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;errorList&lt;/code&gt;&amp;nbsp;property a&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;var&lt;/code&gt;. The rest of the following scripts run under either PHP version.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 5&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// class definition&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// class encapsulating data validation functions&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;formValidator&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define properties&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;private&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_errorList&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define methods&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// constructor&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;__construct&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;resetErrorList&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// initialize error list&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;private function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;resetErrorList&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;_errorList&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= array();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check whether input is empty&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isEmpty&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return (!isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) ||&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.trim.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;trim&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) ==&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) ?&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;true&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check whether input is a string&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isString&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.is-string.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;is_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check whether input is a number&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isNumber&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.is-numeric.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;is_numeric&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check whether input is an integer&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isInteger&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.intval.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;intval&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) ==&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) ?&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;true&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check whether input is alphabetic&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isAlpha&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.preg-match.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;preg_match&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;/^[a-zA-Z]+$/&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check whether input is within a numeric range&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isWithinRange&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$min&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$max&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.is-numeric.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;is_numeric&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) &amp;amp;&amp;amp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$value&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$min&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;amp;&amp;amp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$value&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$max&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) ?&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;true&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check whether input is a valid email address&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isEmailAddress&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.eregi.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;eregi&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;^([a-z0-9])+([\.a-z0-9_-])*@([a-z0-9_-])+(\.[a-z0-9_-]+)*\.([a-z]{2,6})$&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check if a value exists in an array&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isInArray&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$array&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.in-array.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;in_array&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$array&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// add an error to the error list&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;addError&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$field&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$message&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;_errorList&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[] = array(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;field&#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$field&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;message&#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$message&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check if errors exist in the error list&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isError&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sizeof.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sizeof&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;_errorList&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) ?&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;true&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// return the error list to the caller&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getErrorList&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;_errorList&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// destructor&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// de-initialize error list&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;__destruct&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;unset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;_errorList&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// end class definition&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Stripped down to its bare bones, this&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;formValidator&lt;/code&gt;&amp;nbsp;class consists of two&lt;br /&gt;
primary components.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The first is a series of methods that accept the data to be validated, test this data to&lt;br /&gt;
see whether or not it is valid (however “valid” may be defined within the scope of the&lt;br /&gt;
method), and return a Boolean result code. Here’s a list of the supported methods:&lt;/div&gt;
&lt;ul style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; list-style: none; margin: 0px 0px 1.5em; outline: 0px; padding: 0px 0px 0px 30px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isEmpty()&lt;/code&gt;&amp;nbsp;– tests if a value is an empty string&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isString()&lt;/code&gt;&amp;nbsp;– tests if a value is a string&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isNumber()&lt;/code&gt;&amp;nbsp;– tests if a value is a numeric string&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isInteger()&lt;/code&gt;&amp;nbsp;– tests if a value is an integer&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isAlpha()&lt;/code&gt;&amp;nbsp;– tests if a value consists only of alphabetic characters&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isEmailAddress()&lt;/code&gt;&amp;nbsp;– tests if a value is an email address&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isWithinRange()&lt;/code&gt;&amp;nbsp;– tests if a value falls within a numeric range&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isInArray()&lt;/code&gt;&amp;nbsp;– tests if a value exists in an array&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Obviously, the list above is not exhaustive – you should feel free to add to it as per&lt;br /&gt;
your own requirements.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In earlier examples in this tutorial, I set things up so that the data validation routine&lt;br /&gt;
would terminate script processing immediately with&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;die()&lt;/code&gt;&amp;nbsp;if it encountered&lt;br /&gt;
an input error. In the real world, such abrupt termination on the first error is not&lt;br /&gt;
usually a good idea; instead, it’s more efficient to process&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;all&lt;/i&gt;&amp;nbsp;the user’s input,&lt;br /&gt;
identify&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;all&lt;/i&gt;&amp;nbsp;the errors, and then list them for the user to correct at once.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
That’s where the second component of this class comes in. It’s a PHP array that holds a&lt;br /&gt;
list of all the errors encountered during the validation process, and some methods to&lt;br /&gt;
manipulate this structure. Here’s a list:&lt;/div&gt;
&lt;ul style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; list-style: none; margin: 0px 0px 1.5em; outline: 0px; padding: 0px 0px 0px 30px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isError()&lt;/code&gt;&amp;nbsp;– check if any errors exist in the error list&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;addError()&lt;/code&gt;&amp;nbsp;– add an error to the error list&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getErrorList()&lt;/code&gt;&amp;nbsp;– retrieve the current list of errors&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;resetErrorList()&lt;/code&gt;&amp;nbsp;– reset the error list&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
This might all seem somewhat abstruse to you at the moment. Let’s jump&lt;br /&gt;
into a practical example and all the code above will begin to make more sense.&lt;br /&gt;
First, we need a straightforward HTML form:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;b&amp;gt;Fields marked with * are mandatory&amp;lt;/b&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;form action = &#39;processor.php&#39; method = &#39;post&#39;&amp;gt;&lt;br /&gt;
&amp;lt;b&amp;gt;Name*:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;input type = &#39;text&#39; name = &#39;name&#39; size = &#39;15&#39;&amp;gt;&lt;br /&gt;
&amp;lt;p /&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;b&amp;gt;Age*:&amp;lt;/b&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;input type = &#39;text&#39; name = &#39;age&#39; size = &#39;2&#39; maxlength = &#39;2&#39;&amp;gt;&lt;br /&gt;
&amp;lt;p /&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;b&amp;gt;Email address*:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;input type = &#39;text&#39; name = &#39;email&#39; size = &#39;30&#39;&amp;gt;&lt;br /&gt;
&amp;lt;p /&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;b&amp;gt;Sex*:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;input type = &#39;radio&#39; name = &#39;sex&#39; value = &#39;m&#39;&amp;gt;Male&lt;br /&gt;
&amp;lt;input type = &#39;radio&#39; name = &#39;sex&#39; value = &#39;f&#39;&amp;gt;Female&lt;br /&gt;
&amp;lt;p /&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;b&amp;gt;Color*:&amp;lt;/b&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;select name = &#39;color&#39;&amp;gt;&lt;br /&gt;
&amp;lt;option value = &#39;&#39;&amp;gt;-select one-&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;option value = &#39;r&#39;&amp;gt;Red&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;option value = &#39;g&#39;&amp;gt;Green&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;option value = &#39;b&#39;&amp;gt;Blue&amp;lt;/option&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;option value = &#39;s&#39;&amp;gt;Silver&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;br /&gt;
&amp;lt;p /&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;b&amp;gt;Insurance*:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;select name = &#39;insurance&#39;&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;option value = &#39;&#39;&amp;gt;-select one-&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;option value = &#39;1&#39;&amp;gt;Basic&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;option value = &#39;2&#39;&amp;gt;Enhanced&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;option value = &#39;3&#39;&amp;gt;Premium&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;lt;/select&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;p /&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;b&amp;gt;Optional features:&amp;lt;/b&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;input type = &#39;checkbox&#39; name = &#39;options[]&#39; value = &#39;PSTR&#39;&amp;gt;Power steering&lt;br /&gt;
&amp;lt;input type = &#39;checkbox&#39; name = &#39;options[]&#39; value = &#39;AC&#39;&amp;gt;Air-conditioning&lt;br /&gt;
&amp;lt;input type = &#39;checkbox&#39; name = &#39;options[]&#39; value = &#39;4WD&#39;&amp;gt;Four-wheel drive&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;input type = &#39;checkbox&#39; name = &#39;options[]&#39; value = &#39;SR&#39;&amp;gt;Sun roof&lt;br /&gt;
&amp;lt;input type = &#39;checkbox&#39; name = &#39;options[]&#39; value = &#39;LUP&#39;&amp;gt;Leather upholstery&lt;br /&gt;
&amp;lt;p /&amp;gt;&lt;br /&gt;
&amp;lt;input type = &#39;submit&#39; name = &#39;submit&#39; value = &#39;Save&#39;&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Now, we need a PHP script to process the input sent through this form, using my new&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;formValidator&lt;/code&gt;&amp;nbsp;object. Save this as&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;processor.php&lt;/i&gt;:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// include file containing class&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;include(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;class.formValidator.php&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// instantiate object&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fv&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;formValidator&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// start checking the data&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// check name&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fv&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isEmpty&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fv&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;addError&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Name&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Please enter your name&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check age and age range&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fv&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isNumber&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;age&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fv&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;addError&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Age&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Please enter your age&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;br /&gt;
else if (!&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fv&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isWithinRange&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;age&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;],&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;99&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fv&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;addError&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Age&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Please enter an age value in the numeric range 1-99&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check sex&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;sex&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fv&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;addError&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Sex&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Please select your gender&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check email address&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fv&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isEmailAddress&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;email&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fv&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;addError&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Email address&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Please enter a valid email address&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check color&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fv&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isEmpty&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;color&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fv&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;addError&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Color&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Please select one of the listed colors&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check insurance type&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fv&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isEmpty&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;insurance&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fv&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;addError&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Insurance&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Please select one of the listed insurance types&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check optional features&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;options&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fv&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isInArray&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;options&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;],&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;4WD&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) &amp;amp;&amp;amp; !&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fv&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isInArray&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;options&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;],&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;PSTR&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fv&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;addError&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Optional features&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Please also select Power Steering if you would like Four-Wheel Drive&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check to see if any errors were generated&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fv&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isError&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;()) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print errors&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&amp;lt;b&amp;gt;The operation could not be performed because one or more error(s) occurred.&amp;lt;/b&amp;gt; &amp;lt;p /&amp;gt; Please resubmit the form after making the following changes:&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&amp;lt;ul&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;foreach (&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fv&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getErrorList&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&amp;lt;li&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;field&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;: &#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;message&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&amp;lt;/ul&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;}&lt;br /&gt;else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// do something useful with the data&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Data OK&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
As the listing above illustrates, the kind of methods exposed by my&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;formValidator()&lt;/code&gt;&lt;br /&gt;
object come in very handy to verify the user’s input. In all cases, the&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isEmpty()&lt;/code&gt;&amp;nbsp;method is used to test if required fields have been filled in,&lt;br /&gt;
while the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isEmailAddress()&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isWithinRange()&lt;/code&gt;&amp;nbsp;methods are used&lt;br /&gt;
for more precise validation. The&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isInArray()&lt;/code&gt;&amp;nbsp;method, very useful for check&lt;br /&gt;
boxes and multiple-select lists, is also a great way to enforce associative rules and&lt;br /&gt;
link specific choices together.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
It’s important to note that the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;formValidator&lt;/code&gt;&amp;nbsp;class created above has&lt;br /&gt;
nothing to do with the visual presentation of either the form or the form’s result page.&lt;br /&gt;
Its methods merely test the input sent to them and return a result code; how that result&lt;br /&gt;
code is interpreted is entirely up to the developer. In the script above, a&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;foreach()&lt;/code&gt;&amp;nbsp;loop iterates over the list of errors and prints them in a&lt;br /&gt;
bulleted list; however, you could just as easily display the errors in a table or write&lt;br /&gt;
them to a log file in a custom format. I’ll leave it to you to experiment with the&lt;br /&gt;
possibilities.&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
That’s about it for this episode of PHP 101. But hey, don’t be depressed – I’ll be back&lt;br /&gt;
soon and, next time, I’m going to be taking everything I’ve taught you and using it to&lt;br /&gt;
build a real-world PHP/MySQL web application. Make sure you don’t miss that!&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/3039543535931301109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/12/php-101-part-13-trashman-cometh-part-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/3039543535931301109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/3039543535931301109'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/12/php-101-part-13-trashman-cometh-part-2.html' title='PHP 101 (part 13): The Trashman Cometh – Part 2'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s72-c/php_mysql_logo.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-4954530060394268097</id><published>2013-12-25T16:32:00.002-08:00</published><updated>2013-12-25T16:35:42.441-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP 101 (part 13): The Trashman Cometh – Part 1"/><title type='text'>PHP 101 (part 13): The Trashman Cometh – Part 1</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s1600/php_mysql_logo.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;185&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s320/php_mysql_logo.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/h2&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Waiting to Exhale&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Maybe you’ve heard the term&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;GIGO&lt;/b&gt;&amp;nbsp;before.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If you haven’t, it stands for&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;G&lt;/b&gt;arbage&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;I&lt;/b&gt;n,&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;G&lt;/b&gt;arbage&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;O&lt;/b&gt;ut, and&lt;br /&gt;
it’s a basic fact of computer programming: if you feed your program bad input, you’re almost&lt;br /&gt;
certainly going to get bad output. And no matter which way you cut it, bad output is not a&lt;br /&gt;
Good Thing for a programmer who wants to get noticed.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In case you think I’m exaggerating, let me give you a simple example. Consider an online loan&lt;br /&gt;
calculator that allows a user to input a desired loan amount, finance term and interest rate.&lt;br /&gt;
Let’s assume that the application doesn’t include any error checks, and that the user decides&lt;br /&gt;
to enter that magic number, 0, into the&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Term&lt;/i&gt;&amp;nbsp;field.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You can imagine the result. After a few internal calculations the application will end up&lt;br /&gt;
attempting to divide the total amount payable by zero. The slew of ugly error messages&lt;br /&gt;
that follow don’t really bear discussion, but it’s worth noting that they could have been&lt;br /&gt;
avoided had the developer had the foresight to include an&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;input validation routine&lt;/b&gt;&lt;br /&gt;
when designing the application.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The moral of this story? If you’re serious about using PHP for web development, one of&lt;br /&gt;
the most important things you must learn is how to validate user input and deal with&lt;br /&gt;
potentially unsafe data. Such input verification is one of the most important safeguards&lt;br /&gt;
a developer can build into an application, and a failure to do this can snowball into&lt;br /&gt;
serious problems, or even cause your application to break when it encounters invalid&lt;br /&gt;
or corrupt data.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
That’s where this edition of PHP 101 comes in. Over the next few paragraphs, I’m going to&lt;br /&gt;
show you some basic tricks to validate user input, catch “bad” data before it corrupts&lt;br /&gt;
your calculations and databases, and provide user notification in a gentle, understandable&lt;br /&gt;
and non-threatening way. To prepare for this exercise, I suggest you spin up a CD of John&lt;br /&gt;
Lennon singing ‘&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Imagine&lt;/i&gt;‘, fill your heart with peace and goodwill towards all men,&lt;br /&gt;
and take a few deep, calming breaths. Once you’ve exhaled, we can get going.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading2&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
An Empty Vessel…&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
This tutorial assumes that the user input to be validated arrives through a web form. This&lt;br /&gt;
is not the only way a PHP script can get user data; however, it is the most common way. If&lt;br /&gt;
your PHP application needs to validate command-line input, I’d recommend you read my&lt;br /&gt;
article on the PEAR&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Console_Getopt&lt;/code&gt;&amp;nbsp;class, available for your perusal at&lt;br /&gt;
&lt;a href=&quot;http://www.zend.com/pear/tutorials/Console-Getopt.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://www.zend.com/pear/tutorials/Console-Getopt.php&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
It’s common practice to use client-side scripting languages such as JavaScript or VBScript&lt;br /&gt;
for client-side form validation. However, this type of client-side validation is not&lt;br /&gt;
foolproof. You’re not in control of the client, so if a user turns off JavaScript in&lt;br /&gt;
his or her browser, all your efforts to ensure that the user does not enter irrelevant&lt;br /&gt;
data become – well – irrelevant. That’s why most experienced developers use both&lt;br /&gt;
client-side and server-side validation. Server-side validation involves checking the&lt;br /&gt;
values submitted to the server through a PHP script, and taking appropriate action&lt;br /&gt;
when the input is incorrect.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Let’s begin with&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;the most commonly found input error&lt;/b&gt;: a required form field that&lt;br /&gt;
is missing its value. Take a look at this example:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;submit&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;form action = &#39;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php $_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;PHP_SELF&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&#39; method = &#39;post&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Which sandwich filling would you like?&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type = &#39;text&#39; name = &#39;filling&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type = &#39;submit&#39; name = &#39;submit&#39; value = &#39;Save&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;br /&gt;else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set database variables&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;localhost&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;user&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;secret&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;sandwiches&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get user input&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$filling&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysql-escape-string.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysql_escape_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;filling&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open connection&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysql-connect.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysql_connect&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Unable to connect!&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// select database&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysql-select-db.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysql_select_db&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Unable to select database!&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create query&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;INSERT INTO orders (filling) VALUES (&quot;$filling&quot;)&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysql-query.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysql_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: $query. &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysql-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysql_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;());&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close connection&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysql-close.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysql_close&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// display message&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Your {$_POST[&#39;filling&#39;]} sandwich is coming right up!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;}&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;lt;/body&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
It’s clear from the example above that submitting the form without entering any data&lt;br /&gt;
will result in an empty record being added to the database (assuming no&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;NOT NULL&lt;/code&gt;&lt;br /&gt;
constraints on the target table). To avoid this, it’s important to verify that the form&lt;br /&gt;
does, in fact, contain valid data, and only then perform the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;INSERT&lt;/code&gt;&amp;nbsp;query.&lt;br /&gt;
Here’s how:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;submit&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;form action = &#39;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php $_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;PHP_SELF&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&#39; method = &#39;post&#39;&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Which sandwich filling would you like?&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type = &#39;text&#39; name = &#39;filling&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type = &#39;submit&#39; name = &#39;submit&#39; value = &#39;Save&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;br /&gt;else {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check for required data&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// die if absent&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;filling&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) ||&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.trim.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;trim&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;filling&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) ==&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die(&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ERROR: You can&#39;t have a sandwich without a filling!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$filling&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysql-escape-string.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysql_escape_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.trim.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;trim&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;filling&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set database variables&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;localhost&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;user&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;secret&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;sandwiches&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open connection&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysql-connect.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysql_connect&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Unable to connect!&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// select database&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysql-select-db.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysql_select_db&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Unable to select database!&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create query&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;INSERT INTO orders (filling) VALUES (&quot;$filling&quot;)&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysql-query.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysql_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: $query. &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysql-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysql_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;());&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close connection&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysql-close.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysql_close&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// display message&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Your {$_POST[&#39;filling&#39;]} sandwich is coming right up!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;}&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;lt;/body&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The error check here is both simple and logical: the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;trim()&lt;/code&gt;&amp;nbsp;function is&lt;br /&gt;
used to trim leading and trailing spaces from the field value, which is then compared&lt;br /&gt;
with an empty string. If the match is true, the field was submitted empty, and the&lt;br /&gt;
script dies with an error message before MySQL comes into the picture.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
A common mistake, especially among newbies, is to replace the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isset()&lt;/code&gt;&lt;br /&gt;
and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;trim()&lt;/code&gt;&amp;nbsp;combination with a call to PHP’s&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;empty()&lt;/code&gt;&amp;nbsp;function,&lt;br /&gt;
which tells you if a variable is empty. This isn’t usually a good idea, because&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;empty()&lt;/code&gt;&amp;nbsp;has a fatal flaw: it’ll return true even if a variable contains&lt;br /&gt;
the number 0. The following simple example illustrates this:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// no data, returns empty&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
echo empty(&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) ?&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;$data is empty&quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;$data is not empty&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;br /&amp;gt;\n&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// some data, returns not empty&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;1&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;echo empty(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) ?&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;$data is empty&quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;$data is not empty&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;br /&amp;gt;\n&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// some data, returns empty&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;0&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;echo empty(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) ?&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;$data is empty&quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;$data is not empty&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
So, if your form field is only allowed to hold non-empty, non-zero data,&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;empty()&lt;/code&gt;&amp;nbsp;is a good choice for validating it. But if the range of valid&lt;br /&gt;
values for your field includes the number 0, stick with the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isset()&lt;/code&gt;&lt;br /&gt;
and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;trim()&lt;/code&gt;&amp;nbsp;combination instead.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading3&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Not My Type&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
So now you know how to catch the most basic error – missing data – and stop script&lt;br /&gt;
processing before any damage takes place. But what if the data’s present, but of&lt;br /&gt;
the wrong type or size? Your ‘missing values’ test won’t be triggered, but your&lt;br /&gt;
calculations and database could still be affected. Obviously, then, you need to&lt;br /&gt;
add a further layer of security, wherein the data type of the user input is also&lt;br /&gt;
verified.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s an example which illustrates:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;submit&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;form action = &#39;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php $_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;PHP_SELF&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&#39; method = &#39;post&#39;&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;How many sandwiches would you like? (min 1, max 9)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type = &#39;text&#39; name = &#39;quantity&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type = &#39;submit&#39; name = &#39;submit&#39; value = &#39;Save&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;br /&gt;else {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check for required data&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// die if absent&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;quantity&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) ||&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.trim.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;trim&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;quantity&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) ==&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die (&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ERROR: Can&#39;t make &#39;em if you don&#39;t say how many!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check if input is a number&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.is-numeric.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;is_numeric&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;quantity&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die (&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ERROR: Whatever you just said isn&#39;t a number!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check if input is an integer&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.intval.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;intval&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;quantity&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) !=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;quantity&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die (&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ERROR: Can&#39;t do halves, quarters or thirds... I&#39;d lose my job!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check if input is in the range 1-9&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if ((&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;quantity&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] &amp;lt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) || (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;quantity&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die (&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;ERROR: I can only make between 1 and 9 sandwiches per order!&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// process the data&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;I&#39;m making you {$_POST[&#39;quantity&#39;]} sandwiches. Hope you can eat them all!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;}&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Notice that once I’ve established that the field contains some data, I’ve added a&lt;br /&gt;
bunch of tests to make sure it meets data type and range constraints. First, I’ve checked&lt;br /&gt;
if the value is numeric, with the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;is_numeric()&lt;/code&gt;&amp;nbsp;function. This function tests&lt;br /&gt;
a string to see if it is a&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;numeric string&lt;/i&gt;&amp;nbsp;– that is, a string consisting only of&lt;br /&gt;
numbers.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Assuming what you’ve got is a number, the next step is to make sure it’s an integer value&lt;br /&gt;
between 1 and 9. To test if it’s an integer, I’ve used the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;intval()&lt;/code&gt;&amp;nbsp;function&lt;br /&gt;
to extract the integer part of the value, and tested it against the value itself. Float&lt;br /&gt;
values (such as 2.5) will fail this test; integer values will pass it. The final step before&lt;br /&gt;
green-lighting the value is to see if it falls between 1 and 9. This is easy to&lt;br /&gt;
accomplish with a couple of inequality tests.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Whilst on the topic, it’s also worth mentioning the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;strlen()&lt;/code&gt;&amp;nbsp;function, which&lt;br /&gt;
returns the length of a string. This can come in handy to make sure that form input&lt;br /&gt;
doesn’t exceed a particular length. The following example shows how:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;submit&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;form action = &#39;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php $_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;PHP_SELF&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&#39; method = &#39;post&#39;&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Enter a nickname 6-10 characters long:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type = &#39;text&#39; name = &#39;nick&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type = &#39;submit&#39; name = &#39;submit&#39; value = &#39;Save&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;br /&gt;else {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check for required data&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// die if absent&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;nick&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) ||&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.trim.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;trim&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;nick&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) ==&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die (&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;ERROR: Come on, surely you can think of a nickname! How about Pooky?&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check if input is of the right length&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.strlen.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;strlen&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;nick&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) &amp;gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;6&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;amp;&amp;amp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.strlen.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;strlen&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;nick&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) &amp;lt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die (&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ERROR: That&#39;s either too long or too short!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// process the data&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;I&#39;ll accept the nickname {$_POST[&#39;nick&#39;]}, seeing as it&#39;s you!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;}&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here, the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;strlen()&lt;/code&gt;&amp;nbsp;function is used to verify that the string input is&lt;br /&gt;
neither too long nor too short. It’s also a handy way to make sure that input data&lt;br /&gt;
satisfies the field length constraints of your database. For example, if you have a MySQL&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;VARCHAR(10)&lt;/code&gt;&amp;nbsp;field, strings over 10 characters in length will be truncated.&lt;br /&gt;
The&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;strlen()&lt;/code&gt;&amp;nbsp;function can serve as an early warning system in such cases,&lt;br /&gt;
notifying the user of the length mismatch and avoiding data corruption.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading4&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The Dating Game&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Validating dates&lt;/b&gt;&amp;nbsp;is another important aspect of input validation. It’s all too easy,&lt;br /&gt;
given a series of drop-down list boxes or free-form text fields, for a user to select a&lt;br /&gt;
date like&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;29-Feb-2005&lt;/code&gt;&amp;nbsp;or&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;31-Apr-2005&lt;/code&gt;, neither of which is&lt;br /&gt;
valid. Therefore, it’s important to check that date values provided by the user are&lt;br /&gt;
valid before using them in a calculation.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In PHP, this task is significantly simpler than in other languages, because of the&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;checkdate()&lt;/code&gt;&amp;nbsp;function. This function accepts three arguments – month,&lt;br /&gt;
day and year – and returns a Boolean value indicating whether or not the date is&lt;br /&gt;
valid. The following example demonstrates it in action:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;submit&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;form action = &#39;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php $_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;PHP_SELF&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&#39; method = &#39;post&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Enter your date of birth:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;select name = &#39;day&#39;&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// generate day numbers&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;for (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$x&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$x&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;31&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$x&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;option value = $x&amp;gt;$x&amp;lt;/option&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/select&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;select name = &#39;month&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// generate month names&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;for (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$x&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$x&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;12&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$x&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;++) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;option value=$x&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.date.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;date&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;F&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mktime.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mktime&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$x&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)).&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&amp;lt;/option&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/select&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;select name = &#39;year&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// generate year values&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;for (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$x&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1950&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$x&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2005&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$x&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;++) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;option value=$x&amp;gt;$x&amp;lt;/option&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/select&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type = &#39;submit&#39; name = &#39;submit&#39; value = &#39;Save&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;br /&gt;else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check if date is valid&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.checkdate.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;checkdate&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;month&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;],&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;day&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;],&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;year&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die(&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ERROR: The date {$_POST[&#39;day&#39;]}-{$_POST[&#39;month&#39;]}-{$_POST[&#39;year&#39;]} doesn&#39;t exist!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// process the data&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;You entered {$_POST[&#39;day&#39;]}-{$_POST[&#39;month&#39;]}-{$_POST[&#39;year&#39;]} - which is a valid date.&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;}&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Try entering an invalid date, and see how PHP calls you on it. Ain’t that cool?&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If you’re storing date input in a MySQL table, it’s interesting to note that MySQL does&lt;br /&gt;
&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;not&lt;/i&gt;&amp;nbsp;perform any rigorous date verification of its own before accepting a&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;DATE&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;DATETIME&lt;/code&gt;&amp;nbsp;or&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;TIMESTAMP&lt;/code&gt;&amp;nbsp;value. Instead, it&lt;br /&gt;
expects the developer to build date verification into the application itself. The most&lt;br /&gt;
that MySQL will do, if it encounters an obviously illegal value, is convert the date to a&lt;br /&gt;
zero value – not very helpful at all! Read more about this at&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://dev.mysql.com/doc/mysql/en/datetime.html&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://dev.mysql.com/doc/mysql/en/datetime.html&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
While we’re on the topic, let’s talk a little bit more about&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;multiple-choice form&lt;br /&gt;elements&lt;/b&gt;&amp;nbsp;like drop-down list boxes and radio buttons. In cases where it’s mandatory to&lt;br /&gt;
make a choice, a developer must verify that at least one of the available options has&lt;br /&gt;
been selected by the user. This mainly involves clever use of the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isset()&lt;/code&gt;&lt;br /&gt;
and – for multi-select list boxes – the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;is_array()&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sizeof()&lt;/code&gt;&lt;br /&gt;
functions. The next example illustrates this:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;submit&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;form action = &#39;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php $_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;PHP_SELF&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&#39; method = &#39;post&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Pizza base:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type = &#39;radio&#39; name = &#39;base&#39; value = &#39;thin and crispy&#39;&amp;gt;Thin and crispy&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type = &#39;radio&#39; name = &#39;base&#39; value = &#39;deep-dish&#39;&amp;gt;Deep-dish&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br /&amp;gt;&lt;br /&gt;
Cheese:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;select name = &#39;cheese&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;option value = &#39;mozzarella&#39;&amp;gt;Mozzarella&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;option value = &#39;parmesan&#39;&amp;gt;Parmesan&amp;lt;/option&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;option value = &#39;gruyere&#39;&amp;gt;Gruyere&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/select&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Toppings:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;select multiple name = &#39;toppings[]&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;option value = &#39;tomatoes&#39;&amp;gt;Tomatoes&amp;lt;/option&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;option value = &#39;olives&#39;&amp;gt;Olives&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;option value = &#39;pepperoni&#39;&amp;gt;Pepperoni&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;option value = &#39;onions&#39;&amp;gt;Onions&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;option value = &#39;peppers&#39;&amp;gt;Peppers&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;option value = &#39;sausage&#39;&amp;gt;Sausage&amp;lt;/option&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;option value = &#39;anchovies&#39;&amp;gt;Anchovies&amp;lt;/option&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/select&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type = &#39;submit&#39; name = &#39;submit&#39; value = &#39;Save&#39;&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;br /&gt;else {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check radio button&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;base&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;You must select a base for the pizza&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check list box&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;cheese&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;You must select a cheese for the pizza&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check multi-select box&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.is-array.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;is_array&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;toppings&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) ||&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sizeof.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sizeof&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;toppings&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) &amp;lt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die(&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;You must select at least one topping for the pizza&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// process the data&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;One {$_POST[&#39;base&#39;]} {$_POST[&#39;cheese&#39;]} pizza with &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;foreach (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;toppings&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$topping&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$topping&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;, &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;coming up!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Nothing to tax your brain too much here – the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isset()&lt;/code&gt;&amp;nbsp;function merely&lt;br /&gt;
checks to see if at least one of a set of options has been selected, and prints an error&lt;br /&gt;
message if this is not the case. Notice how the multi-select list box is validated: when&lt;br /&gt;
the form is submitted, selections made here are placed in an array, and PHP’s&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;is_array()&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sizeof()&lt;/code&gt;&amp;nbsp;functions are used to test that array&lt;br /&gt;
and ensure that it contains at least one element.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://tcbonlinenow.blogspot.dk/2013/12/php-101-part-13-trashman-cometh-part-1.html&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;PHP 101 (part 13): The Trashman Cometh – Part 2&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/4954530060394268097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/12/php-101-part-13-trashman-cometh-part-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/4954530060394268097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/4954530060394268097'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/12/php-101-part-13-trashman-cometh-part-1.html' title='PHP 101 (part 13): The Trashman Cometh – Part 1'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s72-c/php_mysql_logo.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-4769194406719211106</id><published>2013-12-25T16:26:00.000-08:00</published><updated>2013-12-25T16:35:13.808-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="(Using"/><category scheme="http://www.blogger.com/atom/ns#" term="and/or"/><category scheme="http://www.blogger.com/atom/ns#" term="Create"/><category scheme="http://www.blogger.com/atom/ns#" term="How"/><category scheme="http://www.blogger.com/atom/ns#" term="Java)"/><category scheme="http://www.blogger.com/atom/ns#" term="Language"/><category scheme="http://www.blogger.com/atom/ns#" term="Own"/><category scheme="http://www.blogger.com/atom/ns#" term="Programming"/><category scheme="http://www.blogger.com/atom/ns#" term="Ruby"/><category scheme="http://www.blogger.com/atom/ns#" term="To"/><category scheme="http://www.blogger.com/atom/ns#" term="Your"/><title type='text'>How To Create Your Own Programming Language (Using Ruby and/or Java)</title><content type='html'>&lt;div style=&quot;background-color: white; color: #111111; font-family: Helvetica, arial, sans-serif; font-size: 16px; line-height: 24px; margin-bottom: 20px; margin-top: 20px;&quot;&gt;
&lt;a href=&quot;http://795f48kk056thm4biat-md4p0s.hop.clickbank.net/&quot; style=&quot;color: #0088bb;&quot;&gt;Create Your Own Programming Language&lt;/a&gt;&amp;nbsp;is a interesting new information product and community by Marc-André Cournoyer (of&amp;nbsp;&lt;a href=&quot;http://code.macournoyer.com/thin/&quot; style=&quot;color: #0088bb;&quot;&gt;Thin&lt;/a&gt;&amp;nbsp;fame) that promises to teach you how to create a simple programming language. The&lt;a href=&quot;http://795f48kk056thm4biat-md4p0s.hop.clickbank.net/&quot; style=&quot;color: #0088bb;&quot;&gt;official site&lt;/a&gt;&amp;nbsp;is well worth checking out, even if you don&#39;t want to buy it, as it&#39;s a great example of how to sell a product like this.&amp;nbsp;&lt;i&gt;Create Your Own Programming Language&lt;/i&gt;&amp;nbsp;costs $39.99 and has a two month money back guarantee.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h3 style=&quot;background-color: white; color: #111111; font-family: myriad-pro, &#39;Myriad Pro&#39;, &#39;Trebuchet MS&#39;, myriad-pro, Helvetica, arial, sans-serif; font-size: 1.6em; line-height: 24px; padding-top: 1em;&quot;&gt;
What You Get - 2 Different Approaches&lt;/h3&gt;
&lt;div style=&quot;background-color: white; color: #111111; font-family: Helvetica, arial, sans-serif; font-size: 16px; line-height: 24px; margin-bottom: 20px; margin-top: 20px;&quot;&gt;
The package includes a 53 page PDF (only 44 pages in the earlier copy I received), a pile of source code (for two different types of bootstrapped languages), and a screencast, along with access to a community of other users. Out of the box, you can create your own &quot;programming language&quot; (of sorts) with a single shell script.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #111111; font-family: Helvetica, arial, sans-serif; font-size: 16px; line-height: 24px; margin-bottom: 20px; margin-top: 20px;&quot;&gt;
Two different types of approach are provided. The first is a pure Ruby lexer, parser, and interpreter that lets you build your programming language using mostly Ruby. This is what the PDF covers. The second is a JVM (Java Virtual Machine) based language that provides a bootstrap and execution environment upon which you can build a higher performance language; this is what the screencast covers. In both cases, the default languages are ultra-bare Ruby variants of sorts.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #111111; font-family: Helvetica, arial, sans-serif; font-size: 16px; line-height: 24px; margin-bottom: 20px; margin-top: 20px;&quot;&gt;
&lt;span style=&quot;font-size: 14px; font-weight: bold;&quot;&gt;Quick Results Rather Than Detail&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #111111; font-family: Helvetica, arial, sans-serif; font-size: 16px; line-height: 24px; margin-bottom: 20px; margin-top: 20px;&quot;&gt;
The PDF is short but well produced. It leads you through building a new Ruby-like language called &quot;Awesome&quot; upon the Ruby powered lexer, parser, and interpreter supplied in the package. It lacks detail but covers the broad concepts well with a focus on quick results rather than detail or inane computer science.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #111111; font-family: Helvetica, arial, sans-serif; font-size: 16px; line-height: 24px; margin-bottom: 20px; margin-top: 20px;&quot;&gt;
Likewise, the screencast video isn&#39;t a &quot;everything from start to finish&quot; production in the PeepCode manner. It&#39;s only 11 minutes long and moves incredibly quickly. The screencast covers adding a &quot;while&quot; construct to the JVM-backed language, as well as a &quot;substring&quot; string method and &quot;eval&quot;. The video is good to get a &quot;high level&quot; view of what&#39;s involved (and is probably worth watching before opening the book, just to get a feel) but to get the most out of it you need to be either familiar with the terminology and concepts being covered (partially covered in the PDF) or ready to hit the pause button a lot.&lt;/div&gt;
&lt;h3 style=&quot;background-color: white; color: #111111; font-family: myriad-pro, &#39;Myriad Pro&#39;, &#39;Trebuchet MS&#39;, myriad-pro, Helvetica, arial, sans-serif; font-size: 1.6em; line-height: 24px; padding-top: 1em;&quot;&gt;
It Whets The Appetite; Great For Dabblers&lt;/h3&gt;
&lt;div style=&quot;background-color: white; color: #111111; font-family: Helvetica, arial, sans-serif; font-size: 16px; line-height: 24px; margin-bottom: 20px; margin-top: 20px;&quot;&gt;
&lt;a href=&quot;http://795f48kk056thm4biat-md4p0s.hop.clickbank.net/&quot; style=&quot;color: #0088bb;&quot;&gt;Create Your Own Programming Language&lt;/a&gt;&amp;nbsp;is suitably titled but potentially misleading, since although it does let you create your &quot;own&quot; programming language, the resulting language is within a small gamut of what could be considered to be a &quot;programming language.&quot; No, CYOPL isn&#39;t going to meet lofty technical expectations but it provides a great way to dip your toes into the waters of creating a language, and I wouldn&#39;t hesitate to recommend it to those who want to have a dabble and learn a few things.&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: #111111; font-family: Helvetica, arial, sans-serif; font-size: 16px; line-height: 24px; margin-bottom: 20px; margin-top: 20px;&quot;&gt;
If, however, you consider yourself a bit of a&amp;nbsp;&lt;i&gt;hotshot&lt;/i&gt;&amp;nbsp;and want to really dig deep into building compilers and programming languages, the materials in CYOPL lack the detail and the frankly intimidating level of knowledge you&#39;d need to really design and build a robust programming language. If that&#39;s you, buy a copy of&amp;nbsp;Compilers: Principles, Techniques and Tools by Aho, Lam, Sethi, Ullman&amp;nbsp;and enjoy the ride - it&#39;s an awesome book and considered canonical in the compiler construction field. Alternatively read Loren Segal&#39;s awesome (free) online&amp;nbsp;&lt;a href=&quot;http://gnuu.org/2009/09/18/writing-your-own-toy-compiler/&quot; style=&quot;color: #0088bb;&quot;&gt;Writing Your Own Toy Compiler Using Flex, Bison and LLVM&lt;/a&gt;&amp;nbsp;series.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/4769194406719211106/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/12/how-to-create-your-own-programming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/4769194406719211106'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/4769194406719211106'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/12/how-to-create-your-own-programming.html' title='How To Create Your Own Programming Language (Using Ruby and/or Java)'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-9005179724993600694</id><published>2013-11-02T12:15:00.003-07:00</published><updated>2013-11-02T12:15:36.476-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP 101 (PART 12): BUGGING OUT – PART 2"/><title type='text'>PHP 101 (PART 12): BUGGING OUT – PART 2</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s1600/php_mysql_logo.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;185&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s320/php_mysql_logo.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/h2&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Pulling the Trigger&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
So far we’ve been talking about handling errors generated by PHP itself, but why stop&lt;br /&gt;there? PHP allows you to use its built-in error handling system to raise your own custom&lt;br /&gt;errors as well.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
This is accomplished via a function named&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;trigger_error()&lt;/code&gt;, which allows you&lt;br /&gt;to raise any of the three error types reserved for users:&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_USER_NOTICE&lt;/code&gt;,&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_USER_WARNING&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_USER_ERROR&lt;/code&gt;. When these errors are triggered,&lt;br /&gt;PHP’s built-in handler will automatically wake up to handle them.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// function to test a number&lt;br /&gt;&lt;br /&gt;// generates E_USER_WARNING if number is a float&lt;br /&gt;&lt;br /&gt;// generates E_USER_ERROR is number is negative&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;testNumber&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$num&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// float&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// trigger a warning&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.is-float.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;is_float&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$num&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.trigger-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;trigger_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Number $num is not an integer&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_USER_WARNING&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// negative&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// trigger a fatal error&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$num&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.trigger-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;trigger_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Number $num is negative&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_USER_ERROR&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// test the function with different values&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;testNumber&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;testNumber&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;5.6&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;testNumber&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(-&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If you’d like to have a custom error handler to handle your custom errors… well, you’re&lt;br /&gt;just hard to please, aren’t you? Take a look at this next example, which rewrites the&lt;br /&gt;previous script to use a user-defined error handler:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// function to test a number&lt;br /&gt;&lt;br /&gt;// generates E_USER_WARNING if number is a float&lt;br /&gt;&lt;br /&gt;// generates E_USER_ERROR is number is negative&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;testNumber&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$num&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// float&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// trigger a warning&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.is-float.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;is_float&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$num&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.trigger-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;trigger_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Number $num is not an integer&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_USER_WARNING&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// negative&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// trigger a fatal error&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$num&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.trigger-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;trigger_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Number $num is negative&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_USER_ERROR&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// custom error handler&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;myErrorHandler&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$type&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$msg&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$line&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$context&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;switch (&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$type&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// warnings&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;case&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_USER_WARNING&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// report error&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Non-fatal error on line $line of $file: $msg &amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// fatals&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;case&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_USER_ERROR&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// report error and die()&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Fatal error on line $line of $file: $msg &amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// notices&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;default:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// do nothing&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;break;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set the name of the custom handler&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.set-error-handler.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;set_error_handler&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;myErrorHandler&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// test the function with different values&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;testNumber&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;testNumber&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;5.6&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;testNumber&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(-&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Note that it is the responsibility of the custom handler to&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;die()&lt;/code&gt;&amp;nbsp;in the&lt;br /&gt;event of user-generated fatal errors – PHP will not do this automatically.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You can use the same method to deal with exceptions too. Scroll on down, and&lt;br /&gt;let me show you how.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading6&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Catching Up&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If you’re using PHP 5, you also have an alternative to the techniques discussed&lt;br /&gt;so far in the new Exception model (exception is Geek for error). Exceptions are new&lt;br /&gt;to PHP (although they’ve been in languages like Java and Python for ages) and they’re&lt;br /&gt;stirring up a great deal of excitement.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In the exception-based approach, program code is wrapped in a&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;try()&lt;/code&gt;&amp;nbsp;block,&lt;br /&gt;and exceptions generated by it are “caught” and resolved by a&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch()&lt;/code&gt;&amp;nbsp;block.&lt;br /&gt;Multiple&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch()&lt;/code&gt;&amp;nbsp;blocks are possible, each one dealing with a different&lt;br /&gt;error type; this allows developers to trap different types of errors and execute&lt;br /&gt;appropriate exception-handling.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s what a typical&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;try-catch()&lt;/code&gt;&amp;nbsp;block looks like:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;try {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;execute this block&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;catch (exception type 1) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;execute this block to resolve exception type 1&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;catch (exception type 2) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;execute this block to resolve exception type 2&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;... and so on ...&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
When PHP encounters code wrapped within a&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;try-catch()&lt;/code&gt;&amp;nbsp;block, it first&lt;br /&gt;attempts to execute the code within the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;try()&lt;/code&gt;&amp;nbsp;block. If this code is&lt;br /&gt;processed without any exceptions being generated, control transfers to the lines&lt;br /&gt;following the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;try-catch()&lt;/code&gt;&amp;nbsp;block. However, if an exception is generated&lt;br /&gt;while running the code within the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;try()&lt;/code&gt;&amp;nbsp;block, PHP stops execution of&lt;br /&gt;the block at that point and begins checking each&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch()&lt;/code&gt;&amp;nbsp;block to see&lt;br /&gt;if there is a handler for the exception. If a handler is found, the code within the&lt;br /&gt;appropriate&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch()&lt;/code&gt;&amp;nbsp;block is executed; if not, a fatal error is generated.&lt;br /&gt;It is even possible to handle that fatal error in a nice way using exceptions; see&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.php.net/set-exception-handler&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://www.php.net/set-exception-handler&lt;/a&gt;&amp;nbsp;for more on this.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The exceptions themselves are generated via PHP’s&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;throw&lt;/code&gt;&amp;nbsp;statement. The&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;throw&lt;/code&gt;&amp;nbsp;statement needs to be passed a descriptive message, and an optional&lt;br /&gt;error code. When the exception is raised, this description and code will be made&lt;br /&gt;available to the exception handler.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Wanna see how this works? Here’s an example:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 5&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.error-reporting.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;error_reporting&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// try this code&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;try {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;somefile.txt&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open file&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fh&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.fopen.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;fopen&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;r&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Exception&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Could not open file!&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// read file contents&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.fread.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;fread&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fh&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.filesize.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;filesize&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;))) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Exception&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Could not read file!&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close file&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.fclose.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;fclose&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fh&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print file contents&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// catch errors if any&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Exception $e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Something bad just happened...&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If the file doesn’t exist or is unreadable, the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;throw&lt;/code&gt;&amp;nbsp;statement will&lt;br /&gt;generate an exception (basically, an instance of PHP’s built-in&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Exception&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
object) and pass it a message describing the error. When such an exception is generated,&lt;br /&gt;control passes to the first&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch()&lt;/code&gt;&amp;nbsp;block. If the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch()&lt;/code&gt;&amp;nbsp;block&lt;br /&gt;can handle the exception type, the code within the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch()&lt;/code&gt;&amp;nbsp;block is executed.&lt;br /&gt;If the first&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch()&lt;/code&gt;&amp;nbsp;block cannot handle the generated exception, control&lt;br /&gt;passes to the next one.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Don’t worry too much about “exception types” at this point – all will be explained shortly.&lt;br /&gt;For the moment, all you need to know is that the generic&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch()&lt;/code&gt;&amp;nbsp;block above&lt;br /&gt;will catch all exceptions, regardless of type.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Now, there’s one problem with the previous listing. Although the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch()&lt;/code&gt;&lt;br /&gt;block will trap the exception and print a message, it can’t display the descriptive&lt;br /&gt;message sent by the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;throw&lt;/code&gt;&amp;nbsp;statement with the exception. To access this&lt;br /&gt;message, as well as a couple of other interesting pieces of information, it is necessary&lt;br /&gt;to use some of the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Exception&lt;/code&gt;&amp;nbsp;object’s built-in methods. Take a look at this&lt;br /&gt;revision of the previous script, which illustrates:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 5&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.error-reporting.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;error_reporting&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// try this code&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;try {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;somefile.txt&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open file&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fh&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.fopen.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;fopen&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;r&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw new&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Exception&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Could not open file!&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;12&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// read file contents&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.fread.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;fread&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fh&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.filesize.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;filesize&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;))) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw new&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Exception&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Could not read file!&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;9&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close file&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.fclose.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;fclose&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fh&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print file contents&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// catch errors if any&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Exception $e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&amp;lt;h2&amp;gt;Exception&amp;lt;/h2&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Error message: &#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getMessage&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Error code: &#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getCode&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;File and line: &#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getFile&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;(&#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getLine&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;)&amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Trace: &#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getTraceAsString&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
When you run this script, you’ll see that the message generated by the exception handler contains:&lt;/div&gt;
&lt;ul style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; list-style: none; margin: 0px 0px 1.5em; outline: 0px; padding: 0px 0px 0px 30px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;the descriptive data sent by&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;throw&lt;/code&gt;,&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;an error code (also sent by&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;throw&lt;/code&gt;),&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;the file name and line number where the exception occurred, and&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;a stack trace indicating the exception’s progress through the class hierarchy, if there is one.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
This data is generated by calling the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Exception&lt;/code&gt;&amp;nbsp;object’s&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getMessage()&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getCode()&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getFile()&lt;/code&gt;,&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getLine()&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getTraceAsString()&lt;/code&gt;&amp;nbsp;methods respectively inside&lt;br /&gt;the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch()&lt;/code&gt;&amp;nbsp;block.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading7&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Adding Some Class&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You can handle different exceptions in different ways, by sub-classing the generic&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Exception&lt;/code&gt;&amp;nbsp;object and using more than one&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch()&lt;/code&gt;&amp;nbsp;block. The&lt;br /&gt;following example is a simple illustration of this:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 5&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// sub-class the Exception class&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;NegativeNumException&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;extends&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Exception&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{}&lt;br /&gt;&lt;br /&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;OutOfRangeException&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;extends&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Exception&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{}&lt;br /&gt;&lt;br /&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;FloatException&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;extends&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Exception&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// function to test a number&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;testNumber&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$num&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// float&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// trigger an exception&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.is-float.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;is_float&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$num&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;FloatException&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$num&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// negative&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// trigger an exception&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$num&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;NegativeNumException&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$num&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// out of range&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// trigger an exception&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$num&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1000&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;||&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$num&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;OutOfRangeException&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$num&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// try this code&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;try {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;testNumber&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(-&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;19&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// catch errors, if any&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;NegativeNumException $e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;A negative number was provided (&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getMessage&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;). Please provide a positive integer between 100 and 1000.&amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;br /&gt;&lt;br /&gt;catch (&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;OutOfRangeException $e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;The number provided is out of range (&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getMessage&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;). Please provide a positive integer between 100 and 1000.&amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;catch (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;FloatException $e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;The number provided is not an integer (&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getMessage&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;). Please provide a positive integer between 100 and 1000.&amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;catch (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Exception $e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Error message: &#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getMessage&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Error code: &#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getCode&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;File and line: &#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getFile&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;(&#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getLine&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;)&amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Trace: &#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getTraceAsString&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In this case, I’ve created three new&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Exception&lt;/code&gt;&amp;nbsp;sub-classes from the base&lt;br /&gt;object, one for each possible error. Next, I’ve set up&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch()&lt;/code&gt;&amp;nbsp;blocks for&lt;br /&gt;each exception type, and written exception-handling code that is specific to each type.&lt;br /&gt;Depending on which exception occurs (you can generate different ones by sending the&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;testNumber()&lt;/code&gt;&amp;nbsp;function different values), the appropriate&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch()&lt;/code&gt;&lt;br /&gt;block will be invoked and a different error message will be printed.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Note that because PHP will always use the first&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch()&lt;/code&gt;&amp;nbsp;block that matches&lt;br /&gt;the exception type, and because the generic&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Exception&lt;/code&gt;&amp;nbsp;class matches all&lt;br /&gt;exceptions, the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch()&lt;/code&gt;&amp;nbsp;blocks must be arranged in the order of most&lt;br /&gt;specific first. This has been done in the example above, where the generic&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch()&lt;/code&gt;&amp;nbsp;block appears last on the list.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s another example, this one illustrating a more useful application – using the&lt;br /&gt;exception model in a user authentication class to provide easy-to-understand error&lt;br /&gt;handling. Take a look:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 5&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// class definition&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;userAuth&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define properties&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;private&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$username&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$passwd&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$passwdFile&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// constructor&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// must be passed username and non-encrypted password&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;__construct&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$username&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$password&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;username&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$username&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;passwd&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$password&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set .htaccess-style file to check for passwords&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;setPasswdFile&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;passwdFile&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// perform password verification&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;authenticateUser&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check that the file exists&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.file-exists.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;file_exists&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;passwdFile&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;FileException&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Password file cannot be found: &quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;passwdFile&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check that the file is readable&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.is-readable.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;is_readable&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;passwdFile&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;FileException&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to read password file: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;passwdFile&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// read file&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.file.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;file&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;passwdFile&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// iterate through file&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;foreach (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$line&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$arr&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.explode.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;explode&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;:&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$line&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if username matches, test password&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$arr&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] ==&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;username&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get salt and crypt(), assuming encryption&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$salt&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.substr.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;substr&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$arr&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;],&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if match, user/pass combination is correct&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$arr&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] ==&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.crypt.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;crypt&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;passwd&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$salt&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;User was authenticated&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// do some other stuff&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// otherwise return exception&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;throw new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;AuthException&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Incorrect password&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// could not find a username match&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// return exception&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;throw new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;AuthException&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;No such user&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// end class definition&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// subclass exceptions&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;FileException&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;extends&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Exception&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{};&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
class&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;AuthException&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;extends&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Exception&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{};&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// try the code&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;try {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create instance&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$ua&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;userAuth&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;joe&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;secret&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set password file&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$ua&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;setPasswdFile&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;password.txt&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// perform authentication&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$ua&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;authenticateUser&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// catch authentication failures, if any&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;FileException $e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print file errors&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;A file error occurred. &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getMessage&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;catch (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;AuthException $e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// an authentication error occurred&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;An authentication error occurred. &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getMessage&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// more normally, redirect to new page on auth errors, e.g.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// header (&#39;Location: login_fail.php&#39;);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;br /&gt;&lt;br /&gt;catch (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Exception $e&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;An unknown error occurred&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here, depending on the type of error, either a&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;FileException()&lt;/code&gt;&amp;nbsp;or an&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;AuthException()&lt;/code&gt;&amp;nbsp;will be generated – and handled by the corresponding&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;catch()&lt;/code&gt;&amp;nbsp;block. Notice how easy the exception handling framework is to read&lt;br /&gt;and extend. It’s precisely this ease of use and extensibility that helps the new PHP 5&lt;br /&gt;model score over the earlier, more primitive techniques of handling application errors.&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Well, that’s about it for the moment. Come back soon, for more PHP 101!&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/9005179724993600694/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-12-bugging-out-part-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/9005179724993600694'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/9005179724993600694'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-12-bugging-out-part-2.html' title='PHP 101 (PART 12): BUGGING OUT – PART 2'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s72-c/php_mysql_logo.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-2973883893951019939</id><published>2013-11-02T12:13:00.002-07:00</published><updated>2013-11-02T12:16:24.376-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP 101 (part 12): Bugging Out – Part 1"/><title type='text'>PHP 101 (part 12): Bugging Out – Part 1</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s1600/php_mysql_logo.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;185&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s320/php_mysql_logo.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/h2&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Fire-Proofing Your Code&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Even the best developers make mistakes sometimes. That’s why most programming languages&lt;br /&gt;
- including PHP – come with built-in capabilities to catch errors and take remedial&lt;br /&gt;
action. This action can be as simple as displaying an error message, or as complex as&lt;br /&gt;
sending the site administrator an email with a complete stack trace.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
To make it easier to do this, PHP comes with a full-featured error handling API that can&lt;br /&gt;
be used to trap and resolve errors. In addition to deciding which types of errors a user&lt;br /&gt;
sees, you can also replace the built-in error handling mechanism with your own custom (and&lt;br /&gt;
usually more creative) functions. If you’re using PHP 5, you get a bonus: a spanking-new&lt;br /&gt;
exception model, which lets you wrap your code in Java-like&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;try-catch()&lt;/code&gt;&amp;nbsp;blocks&lt;br /&gt;
for more efficient error handling.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In this edition of PHP 101, I’m going to discuss all these things, giving you a crash course&lt;br /&gt;
in how to add error-handling to your PHP application. Keep reading – this is pretty cool stuff!&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading2&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Rogues Gallery&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Before we get into the nitty-gritty of how to write an error handler, you need to know a&lt;br /&gt;
little theory.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Normally, when a PHP script encounters an error, it displays a message indicating the cause&lt;br /&gt;
of the error and may also (depending on how serious the error is) terminate script execution.&lt;br /&gt;
Now, while this behaviour is acceptable during the development phase, it cannot continue once&lt;br /&gt;
a PHP application has been released to actual users. In “live” situations, it is unprofessional&lt;br /&gt;
to display cryptic error messages (which are usually incomprehensible to non-technical users);&lt;br /&gt;
it is more professional to intercept these errors and either resolve them (if resolution is&lt;br /&gt;
possible), or notify the user with an easily-understood error message (if not).&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
There are three basic types of runtime errors in PHP:&lt;/div&gt;
&lt;ol style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; list-style: none; margin: 0px 0px 1.5em; outline: 0px; padding: 0px 0px 0px 30px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Notices&lt;/b&gt;: These are trivial, non-critical errors that PHP encounters while&lt;br /&gt;executing a script – for example, accessing a variable that has not yet been defined.&lt;br /&gt;By default, such errors are not displayed to the user at all – although, as you will see,&lt;br /&gt;you can change this default behaviour.&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Warnings&lt;/b&gt;: These are more serious errors – for example, attempting to&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;include()&lt;/code&gt;&amp;nbsp;a file which does not exist. By default, these errors are displayed&lt;br /&gt;to the user, but they do not result in script termination.&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Fatal errors&lt;/b&gt;: These are critical errors – for example, instantiating an object&lt;br /&gt;of a non-existent class, or calling a non-existent function. These errors cause the&lt;br /&gt;immediate termination of the script, and PHP’s default behaviour is to display them to the&lt;br /&gt;user when they take place.&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
It should be noted that a syntax error in a PHP script – for example, a missing brace&lt;br /&gt;
or semi-colon – is treated as a fatal error and results in script termination. That’s&lt;br /&gt;
why, if you forget a semi-colon at the end of one of your PHP statements, PHP will refuse&lt;br /&gt;
to execute your script until you correct the mistake.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
PHP errors can be generated by the Zend engine, by PHP built-in functions, or by user-defined&lt;br /&gt;
functions. They may occur at startup, at parse-time, at compile-time or at run-time.&lt;br /&gt;
Internally, these variations are represented by twelve different error types (as of PHP 5),&lt;br /&gt;
and you can read about them at&lt;br /&gt;
&lt;a href=&quot;http://www.php.net/manual/en/ref.errorfunc.php#errorfunc.constants&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://www.php.net/manual/en/ref.errorfunc.php&lt;/a&gt;. Named constants like&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_NOTICE&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_USER_ERROR&lt;/code&gt;&amp;nbsp;provide a convenient way to reference&lt;br /&gt;
the different error types.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
A quick tip here: most of the time, you’ll be worrying about run-time errors&lt;br /&gt;
(&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_NOTICE&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_WARNING&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_ERROR&lt;/code&gt;) and&lt;br /&gt;
user-triggered errors (&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_USER_NOTICE&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_USER_WARNING&lt;/code&gt;&amp;nbsp;and&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_USER_ERROR&lt;/code&gt;). During the debug phase, you can use the shortcut&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_ALL&lt;/code&gt;&amp;nbsp;type to see all fatal and non-fatal errors generated by your script,&lt;br /&gt;
and in PHP 5 you might also want to use the new&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_STRICT&lt;/code&gt;&amp;nbsp;error type to view&lt;br /&gt;
errors that affect the forward compatibility of your code.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading3&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Early Warning&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
With the theory out of the way, let’s now apply it to some examples. Consider the&lt;br /&gt;
following code snippet:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// initialize the $string variable&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$string&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;a string&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// explode() a string&lt;br /&gt;&lt;br /&gt;// this will generate a warning or E_WARNING because the number of arguments to explode() is incorrect&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.explode.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;explode&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$string&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If you run this script, you’ll get a non-fatal error (&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_WARNING&lt;/code&gt;), which&lt;br /&gt;
means that if you had statements following the call to&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;explode()&lt;/code&gt;, they&lt;br /&gt;
would still get executed. Try it for yourself and see!&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
To generate a fatal error, you need to put in a bit more work. Take a look at this:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// call a non-existent function&lt;br /&gt;&lt;br /&gt;// this will generate a fatal error (E_ERROR)&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;callMeJoe&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here, the call to a non-existent function trips all of PHP’s alarm wires and generates a&lt;br /&gt;
fatal error, which immediately stops script execution.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Now, here’s the interesting bit. You can control which errors are displayed to the user,&lt;br /&gt;
by using a built-in PHP function called&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;error_reporting()&lt;/code&gt;. This&lt;br /&gt;
function accepts a named constant, and tells the script to report only errors that&lt;br /&gt;
match that type. To see this in action, consider the following rewrite of one of the&lt;br /&gt;
earlier scripts to “hide” non-fatal errors:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// report only fatal errors&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.error-reporting.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;error_reporting&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_ERROR&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// initialize the $string variable&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$string&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;string&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// attempt to explode() a string&lt;br /&gt;&lt;br /&gt;// this will not generate a warning because only fatal errors are reported&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.explode.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;explode&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$string&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In this case, when the script executes, no warning will be generated even though the call&lt;br /&gt;
to&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;explode()&lt;/code&gt;&amp;nbsp;contains one less argument than it should.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You can use a similar technique to turn off the display of fatal errors:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// report no fatal errors&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.error-reporting.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;error_reporting&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(~&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_ERROR&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// call a non-existent function&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;callMeJoe&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Keep in mind, though, that just because the error isn’t being reported doesn’t mean it&lt;br /&gt;
isn’t occurring. Although the script above will not display a visible error message, script&lt;br /&gt;
execution will still stop at the point of error and statements subsequent to that point will&lt;br /&gt;
not be executed.&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;error_reporting()&lt;/code&gt;&amp;nbsp;gives you control over which errors are&lt;br /&gt;
displayed; it doesn’t prevent the errors themselves.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Note that there are further settings within&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;php.ini&lt;/i&gt;&amp;nbsp;that should be used on production&lt;br /&gt;
sites. You can (and should) turn off&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;display_errors&lt;/code&gt;, stipulate an&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;error_log&lt;/code&gt;&amp;nbsp;file and switch on&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;log_errors&lt;/code&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Note also that the approach used above to hide error messages, although extremely simple, is&lt;br /&gt;
&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;not&lt;/i&gt;&amp;nbsp;recommended for general use. It is poor programming practice to trap all errors,&lt;br /&gt;
regardless of type, and ignore them; it is far better – and more professional – to anticipate&lt;br /&gt;
the likely errors ahead of time, and write defensive code that watches for them and handles&lt;br /&gt;
them appropriately. This will prevent your users from finding themselves staring at an&lt;br /&gt;
unexplained blank page when something goes wrong.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading4&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Rolling Your Own&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
With this in mind, let’s talk a little bit about changing the way errors are handled.&lt;br /&gt;
Consider a typical PHP error message: it lists the error type, a descriptive message,&lt;br /&gt;
and the name of the script that generated the error. Most of the time, this is more&lt;br /&gt;
than sufficient… but what if your boss is a demanding customer, and insists that&lt;br /&gt;
there must be a “better way”?&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Well, there is. It’s a little function called&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;set_error_handler()&lt;/code&gt;, and it&lt;br /&gt;
allows you to divert all PHP errors to a custom function that you’ve defined, instead&lt;br /&gt;
of sending them to the default handler. This custom function must be capable of&lt;br /&gt;
accepting a minimum of two mandatory arguments (the error type and corresponding&lt;br /&gt;
descriptive message) and up to three additional arguments (the file name and line&lt;br /&gt;
number where the error occurred and a dump of the variable space at the time of error).&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The following example might make this clearer:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define a custom error handler&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.set-error-handler.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;set_error_handler&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;oops&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// initialize the $string variable&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$string&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;a string&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// explode() a string&lt;br /&gt;&lt;br /&gt;// this will generate a warning because the number of arguments to explode() is incorrect&lt;br /&gt;&lt;br /&gt;// the error will be caught by the custom error handler&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.explode.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;explode&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$string&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// custom error handler&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;oops&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$type&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$msg&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$line&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$context&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;h1&amp;gt;Error!&amp;lt;/h1&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;An error occurred while executing this script. Please contact the &amp;lt;a href=mailto:webmaster@somedomain.com&amp;gt;webmaster&amp;lt;/a&amp;gt; to report this error.&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;p /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Here is the information provided by the script:&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;hr&amp;gt;&amp;lt;pre&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error code: $type&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error message: $msg&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Script name and line number of error: $file:$line&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$variable_state&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.array-pop.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;array_pop&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$context&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Variable state when error occurred: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.print-r.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;print_r&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$variable_state&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/pre&amp;gt;&amp;lt;hr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;set_error_handler()&lt;/code&gt;&amp;nbsp;function tells the script that all errors are to&lt;br /&gt;
be routed to my user-defined&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;oops()&lt;/code&gt;&amp;nbsp;function. This function is set up to&lt;br /&gt;
accept five arguments: error type, message, file name, line number, and an array&lt;br /&gt;
containing a lot of information about the context that the error occurred in (including&lt;br /&gt;
server and platform, as well as script information). The final element of the context&lt;br /&gt;
array contains the current value of the guilty variable. These arguments are then used&lt;br /&gt;
to create an error page that is friendlier and more informative than PHP’s standard&lt;br /&gt;
one-line error message.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You can use this custom error handler to alter the error message the user sees, on the&lt;br /&gt;
basis of the error type. Take a look at the next example, which demonstrates this technique:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define a custom error handler&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.set-error-handler.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;set_error_handler&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;oops&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// initialize $string variable&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$string&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;a string&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// this will generate a warning&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.explode.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;explode&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$string&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// custom error handler&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;oops&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$type&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$msg&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$line&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$context&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;switch (&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$type&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// notices&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;case&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_NOTICE&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// do nothing&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;break;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// warnings&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;case&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_WARNING&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// report error&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Non-fatal error on line $line of $file: $msg &amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// other&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;default:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error of type $type on line $line of $file: $msg &amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Note that certain error types can’t be handled in this way. For example, a fatal&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;E_ERROR&lt;/code&gt;&amp;nbsp;will prevent the PHP script from continuing, therefore it can&lt;br /&gt;
never reach a user-created error-handling mechanism. See&amp;nbsp;&lt;a br=&quot;&quot; href=&quot;http://www.php.net/set-error-handler&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;target = &#39;_blank&#39;&amp;gt;http://www.php.net/set-error-handler&lt;/a&gt;&amp;nbsp;for more information on this.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://tcbonlinenow.blogspot.dk/2013/11/php-101-part-12-bugging-out-part-2.html&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;PHP 101 (part 12): Bugging Out – Part 2&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/2973883893951019939/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-12-bugging-out-part-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/2973883893951019939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/2973883893951019939'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-12-bugging-out-part-1.html' title='PHP 101 (part 12): Bugging Out – Part 1'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s72-c/php_mysql_logo.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-1570369288014587188</id><published>2013-11-02T12:11:00.000-07:00</published><updated>2013-11-02T12:11:00.272-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP 101 (part 11): Sinfully Simple"/><title type='text'>PHP 101 (part 11): Sinfully Simple</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s1600/php_mysql_logo.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;185&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s320/php_mysql_logo.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/h2&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Easy Peasy&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Unless you’ve been hiding in a cave for the last few years, you’ve heard about XML – it’s&lt;br /&gt;the toolkit that more and more Web publishers are switching to for content markup. You may&lt;br /&gt;even have seen an XML document in action, complete with user-defined tags and markup, and&lt;br /&gt;you might have wondered how on earth one converts that tangled mess of code into&lt;br /&gt;human-readable content.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The answer is, not easily.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
While PHP has included support for the two standard methods of parsing (read: making sense&lt;br /&gt;of) XML – SAX and DOM – since version 4.0, the complexity and inherent geekiness of these&lt;br /&gt;methods often turned off all but the most dedicated XML developers. All that has changed,&lt;br /&gt;however, with PHP 5.0, which introduces a brand-spanking-new XML extension named SimpleXML&lt;br /&gt;that takes all (and I do mean all) the pain out of processing XML documents. Keep reading,&lt;br /&gt;and find out how.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading2&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The Bad Old Days&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In order to understand why SimpleXML is so cool, a brief history lesson is in order.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In the days before SimpleXML, there were two ways of processing XML documents. The first,&lt;br /&gt;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SAX&lt;/b&gt;&amp;nbsp;or the Simple API for XML, involved traversing an XML document and calling&lt;br /&gt;specific functions as the parser encountered different types of tags. For example, you might&lt;br /&gt;have called one function to process a starting tag, another function to process an ending tag,&lt;br /&gt;and a third function to process the data between them. The second,&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;DOM&lt;/b&gt;&amp;nbsp;or the Document&lt;br /&gt;Object Model, involved creating a tree representation of the XML document in memory, and then&lt;br /&gt;using tree-traversal methods to navigate it. Once a particular node of the tree was reached,&lt;br /&gt;the corresponding content could be retrieved and used.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Neither of these two approaches was particularly user-friendly: SAX required the developer&lt;br /&gt;to custom-craft event handlers for each type of element encountered in an XML file, while&lt;br /&gt;the DOM approach used an object-oriented paradigm which tended to throw developers off, in&lt;br /&gt;addition to being memory-intensive and thus inefficient with large XML documents. In the&lt;br /&gt;larger context also, PHP 4 used a number of different backend libraries for each of its&lt;br /&gt;different XML extensions, leading to inconsistency in the way different XML extensions&lt;br /&gt;worked and thus creating interoperability concerns (as well as a fair amount of confusion&lt;br /&gt;for developers).&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
With PHP 5.0, a concerted effort was made to fix this problem, by adopting the libxml2&lt;br /&gt;library (&lt;a href=&quot;http://www.xmlsoft.org/&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://www.xmlsoft.org/&lt;/a&gt;)&lt;br /&gt;as the standard library for all XML extensions and by getting the various XML extensions&lt;br /&gt;to operate more consistently. The biggest change in the PHP 5 XML pantheon, though, is&lt;br /&gt;the SimpleXML extension developed by Sterling Hughes, Rob Richards and Marcus Börger,&lt;br /&gt;which attempts to make parsing XML documents significantly more user-friendly than it&lt;br /&gt;was in PHP 4.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
SimpleXML works by converting an XML document into an object, and then turning the&lt;br /&gt;elements within that document into object properties which can be accessed using standard&lt;br /&gt;object notation. This makes it easy to drill down to an element at any level of the XML&lt;br /&gt;hierarchy to access its content. Repeated elements at the same level of the document tree&lt;br /&gt;are represented as arrays, while custom element collections can be created using XPath&lt;br /&gt;location paths (of which, more later); these collections can then be processed using PHP’s&lt;br /&gt;standard loop constructs. Accessing element attributes is as simple as accessing the keys&lt;br /&gt;of an associative array – there’s nothing new to learn, and no special code to write.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In order to use SimpleXML and PHP together, your PHP build must include support for&lt;br /&gt;SimpleXML. This support is enabled by default in both the UNIX and Windows versions of&lt;br /&gt;PHP 5. Read more about this at&amp;nbsp;&lt;a br=&quot;&quot; href=&quot;http://www.php.net/manual/en/ref.simplexml.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;target = &quot;_blank&quot;&amp;gt;http://www.php.net/manual/en/ref.simplexml.php&lt;/a&gt;. If you’re a PHP 4&lt;br /&gt;user, you’re out of luck – SimpleXML is only available for PHP 5.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading3&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Petting Zoo&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
To see how SimpleXML works, consider the following XML file:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?xml version&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;1.0&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;pet&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;name&amp;gt;Polly Parrot&amp;lt;/name&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;age&amp;gt;3&amp;lt;/age&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;species&amp;gt;parrot&amp;lt;/species&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;parents&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;mother&amp;gt;Pia Parrot&amp;lt;/mother&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;father&amp;gt;Peter Parrot&amp;lt;/father&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/parents&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/pet&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Now, you need a way to get to the content enclosed between the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;name&amp;gt;&lt;/code&gt;,&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;age&amp;gt;&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;species&amp;gt;&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;parents&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
elements. With SimpleXML, it’s a snap:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set name of XML file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;pet.xml&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// load file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.simplexml-load-file.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;simplexml_load_file&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to load XML file!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// access XML data&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Name: &quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Age: &quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;age&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Species: &quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;species&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Parents: &quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;parents&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mother&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; and &quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;parents&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;father&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The action begins with the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;simplexml_load_file()&lt;/code&gt;&amp;nbsp;function, which accepts&lt;br /&gt;the path and name of the XML file to be parsed. The result of parsing the file is a&lt;br /&gt;PHP object, whose properties correspond to the elements under the root element. The&lt;br /&gt;character data within an element can then be accessed using standard&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;object-&amp;gt;property&lt;/code&gt;&amp;nbsp;notation, beginning with the root element and moving&lt;br /&gt;down the hierarchical path of the document.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Just as you can read, so also can you write. SimpleXML makes it easy to alter the&lt;br /&gt;contents of a particular XML element – simply assign a new value to the corresponding&lt;br /&gt;object property. Here’s an example:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set name of XML file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;pet.xml&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// load file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.simplexml-load-file.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;simplexml_load_file&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to load XML file!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// modify XML data&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Sammy Snail&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;age&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;species&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;snail&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;parents&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mother&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Sue Snail&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;parents&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;father&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Sid Snail&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// write new data to file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.file-put-contents.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;file_put_contents&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;asXML&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;());&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here, the original XML file is first read in, and then the character data enclosed within&lt;br /&gt;each element is altered by assigning new values to the corresponding object property. The&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;asXML()&lt;/code&gt;&amp;nbsp;method, typically used to dump the XML tree back out to the standard&lt;br /&gt;output device, is in this instance combined with the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;file_put_contents()&lt;/code&gt;&lt;br /&gt;function to overwrite the original XML document with the new data.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading4&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Sin City&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Repeated elements at the same level of the XML hierarchy are represented as array elements,&lt;br /&gt;and can be accessed using numeric indices. To see how this works, consider the following XML file:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?xml version&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;1.0&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;sins&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;sin&amp;gt;pride&amp;lt;/sin&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;sin&amp;gt;envy&amp;lt;/sin&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;sin&amp;gt;anger&amp;lt;/sin&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;sin&amp;gt;greed&amp;lt;/sin&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;sin&amp;gt;sloth&amp;lt;/sin&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;sin&amp;gt;gluttony&amp;lt;/sin&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;sin&amp;gt;lust&amp;lt;/sin&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/sins&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s the PHP script that reads it and retrieves the data from it:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set name of XML file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;sins.xml&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// load file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.simplexml-load-file.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;simplexml_load_file&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to load XML file!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// access each &amp;lt;sin&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sin&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sin&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sin&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sin&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sin&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sin&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sin&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If you’d prefer, you can even iterate over the collection with a&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;foreach()&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
loop, as in this next, equivalent listing:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set name of XML file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;sins.xml&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// load file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.simplexml-load-file.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;simplexml_load_file&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to load XML file!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// iterate over &amp;lt;sin&amp;gt; element collection&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;foreach (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sin&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$sin&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;$sin\n&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading5&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The Shape Of Things To Come&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
SimpleXML handles element attributes as transparently as it does elements and their&lt;br /&gt;content. Attribute-value pairs are represented as members of a PHP associative array,&lt;br /&gt;and can be accessed like regular array elements. To see how this works, take a look&lt;br /&gt;at this script:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create XML string&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$str&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= &amp;lt;&amp;lt;&amp;lt; XML&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot;?&amp;gt;&lt;br /&gt;&amp;lt;shapes&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;shape type=&quot;circle&quot; radius=&quot;2&quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;shape type=&quot;rectangle&quot; length=&quot;5&quot; width=&quot;2&quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;shape type=&quot;square&quot; length=&quot;7&quot; /&amp;gt;&lt;br /&gt;&amp;lt;/shapes&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;XML;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// load string&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.simplexml-load-string.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;simplexml_load_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to load XML string!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// for each shape&lt;br /&gt;// calculate area&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;foreach (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;shape&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$shape&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$shape&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;type&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] ==&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;circle&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$area&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.pi.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;pi&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() *&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$shape&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;radius&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] *&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$shape&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;radius&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;elseif (&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$shape&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;type&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] ==&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;rectangle&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$area&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$shape&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;length&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] *&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$shape&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;width&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;elseif (&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$shape&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;type&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] ==&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;square&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$area&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$shape&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;length&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] *&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$shape&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;length&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$area&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;\n&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Unlike previous examples, which used an external XML file, this one creates the XML&lt;br /&gt;dynamically and loads it into SimpleXML with the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;simplexml_load_string()&lt;/code&gt;&lt;br /&gt;method. The XML is then parsed with a&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;foreach()&lt;/code&gt;&amp;nbsp;loop, and the area for&lt;br /&gt;each shape calculated on the basis of the value of each&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;shape&amp;gt;&lt;/code&gt;&lt;br /&gt;element’s type attribute. The listing above demonstrates how attribute values can&lt;br /&gt;be accessed as keys of the attribute array associated with each element property.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading6&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
X Marks The Spot&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
SimpleXML also supports custom element collections, through XPath location paths. For&lt;br /&gt;those of you new to XML,&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;XPath&lt;/b&gt;&amp;nbsp;is a standard addressing mechanism for an XML&lt;br /&gt;document, allowing developers to access collections of elements, attributes or text&lt;br /&gt;nodes within a document. Read more about XPath at&amp;nbsp;&lt;a br=&quot;&quot; href=&quot;http://www.w3.org/TR/xpath.html&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;target = &quot;_blank&quot;&amp;gt;http://www.w3.org/TR/xpath.html&lt;/a&gt;&amp;nbsp;and&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a br=&quot;&quot; href=&quot;http://www.melonfire.com/community/columns/trog/article.php?id=83&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;target = &quot;_blank&quot;&amp;gt;http://www.melonfire.com/community/columns/trog/article.php?id=83&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
To see how this works, consider the following XML document:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?xml version&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;1.0&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;ingredients&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;item&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;desc&amp;gt;Boneless chicken breasts&amp;lt;/desc&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;quantity&amp;gt;2&amp;lt;/quantity&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/item&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;item&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;desc&amp;gt;Chopped onions&amp;lt;/desc&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;quantity&amp;gt;2&amp;lt;/quantity&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/item&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;item&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;desc&amp;gt;Ginger&amp;lt;/desc&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;quantity&amp;gt;1&amp;lt;/quantity&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/item&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;item&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;desc&amp;gt;Garlic&amp;lt;/desc&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;quantity&amp;gt;1&amp;lt;/quantity&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/item&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;item&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;desc&amp;gt;Red chili powder&amp;lt;/desc&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;quantity&amp;gt;1&amp;lt;/quantity&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/item&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;item&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;desc&amp;gt;Coriander seeds&amp;lt;/desc&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;quantity&amp;gt;1&amp;lt;/quantity&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/item&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;item&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;desc&amp;gt;Lime juice&amp;lt;/desc&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;quantity&amp;gt;2&amp;lt;/quantity&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/item&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/ingredients&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Now, let’s suppose you want to print all the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;desc&amp;gt;&lt;/code&gt;&amp;nbsp;elements. You&lt;br /&gt;could do it by iterating over the array of&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;item&amp;gt;&lt;/code&gt;&amp;nbsp;elements, as&lt;br /&gt;discussed earlier…or you could just create a custom collection of only the&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;desc&amp;gt;&lt;/code&gt;&amp;nbsp;elements with the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;xpath()&lt;/code&gt;&amp;nbsp;method, and&lt;br /&gt;iterate over that instead:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set name of XML file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ingredients.xml&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// load file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.simplexml-load-file.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;simplexml_load_file&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to load XML file!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get all the &amp;lt;desc&amp;gt; elements and print&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;foreach (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;xpath&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;//desc&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$desc&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;$desc\n&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Using XPath, you can get even fancier than this – for example, by creating a collection&lt;br /&gt;of only those&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;desc&amp;gt;&lt;/code&gt;&amp;nbsp;elements whose corresponding quantities are two or more.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set name of XML file&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ingredients.xml&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// load file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.simplexml-load-file.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;simplexml_load_file&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to load XML file!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get all the &amp;lt;desc&amp;gt; elements and print&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;foreach (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;xpath&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;//item[quantity &amp;gt; 1]/desc&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$desc&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;$desc\n&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Without XPath, accomplishing this would be far more complicated than the five lines of code&lt;br /&gt;above…try it for yourself and see!&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading7&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
An Evening At The Moulin Rouge&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Now that you’ve seen what XPath can do, let’s wrap this up with an example of how you&lt;br /&gt;might actually use it. Let’s suppose you have a bunch of movie reviews marked up in XML,&lt;br /&gt;like this:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?xml version&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;1.0&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;review id=&quot;57&quot; category=&quot;2&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;title&amp;gt;Moulin Rouge&amp;lt;/title&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;teaser&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Baz Luhrmann&#39;s over-the-top vision of Paris at the turn of the century&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;is witty, sexy...and completely unforgettable&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/teaser&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;cast&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;person&amp;gt;Nicole Kidman&amp;lt;/person&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;person&amp;gt;Ewan McGregor&amp;lt;/person&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;person&amp;gt;John Leguizamo&amp;lt;/person&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;person&amp;gt;Jim Broadbent&amp;lt;/person&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;person&amp;gt;Richard Roxburgh&amp;lt;/person&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/cast&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;director&amp;gt;Baz Luhrmann&amp;lt;/director&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;duration&amp;gt;120&amp;lt;/duration&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;genre&amp;gt;Romance/Comedy&amp;lt;/genre&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;year&amp;gt;2001&amp;lt;/year&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;body&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;A stylishly spectacular extravaganza, Moulin Rouge is hard to&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;categorize; it is, at different times, a love story, a costume drama,&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;a musical, and a comedy. Director Baz Luhrmann (well-known for the&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;very hip William Shakespeare&#39;s Romeo + Juliet) has taken some simple&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;themes - love, jealousy and obsession - and done something completely&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;new and different with them by setting them to music.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;rating&amp;gt;5&amp;lt;/rating&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/review&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Now, you want to display this review on your Web site. So, you need a PHP script to&lt;br /&gt;extract the data from this file and place it in the appropriate locations in an HTML&lt;br /&gt;template. With everything you’ve learned so far, this is a snap…as the code below&lt;br /&gt;illustrates:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set name of XML file&lt;br /&gt;&lt;br /&gt;// normally this would come through GET&lt;br /&gt;&lt;br /&gt;// it&#39;s hard-wired here for simplicity&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;57.xml&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// load file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.simplexml-load-file.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;simplexml_load_file&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to load XML file!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;basefont face=&quot;Arial&quot;&amp;gt;&amp;lt;/head&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;body&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;!-- title and year --&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;h1&amp;gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;nbsp;(&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;year&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;)&amp;lt;/h1&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;!-- slug --&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;h3&amp;gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;teaser&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;lt;/h3&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;!-- review body --&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- director, cast, duration and rating --&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;p align=&quot;right&quot;/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;font size=&quot;-2&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;Director: &amp;lt;b&amp;gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;director&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;lt;/b&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;&lt;br /&gt;Duration: &amp;lt;b&amp;gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;duration&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;nbsp;min&amp;lt;/b&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;br /&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Cast: &amp;lt;b&amp;gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;foreach (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;cast&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;person&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$person&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) { echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;$person &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;; }&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;lt;/b&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;&lt;br /&gt;Rating: &amp;lt;b&amp;gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$xml&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;rating&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;lt;/b&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/font&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;/body&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Pretty simple, huh?&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/1570369288014587188/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-11-sinfully-simple.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/1570369288014587188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/1570369288014587188'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-11-sinfully-simple.html' title='PHP 101 (part 11): Sinfully Simple'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s72-c/php_mysql_logo.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-1372455101388149101</id><published>2013-11-02T12:09:00.000-07:00</published><updated>2013-11-02T12:09:48.256-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP 101 (part 10): A Session In The Cookie Jar"/><title type='text'>PHP 101 (part 10): A Session In The Cookie Jar</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s1600/php_mysql_logo.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;185&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s320/php_mysql_logo.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/h2&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Patience Pays&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Now that you’ve used PHP with MySQL and SQLite, you probably think you know&lt;br /&gt;
everything you need to get started with PHP programming. In fact, you might&lt;br /&gt;
even be thinking of cutting down your visits to Zend.com altogether, giving&lt;br /&gt;
up this series for something flashier and cooler…&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Uh-uh. Big mistake.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You see, while built-in database support makes programming with PHP easy, it&lt;br /&gt;
isn’t the only thing that makes PHP so popular. An easy-to-use XML API and new&lt;br /&gt;
exception handling mechanism (in PHP 5), support for pluggable modules, and&lt;br /&gt;
built-in session management are just some of the many other features that&lt;br /&gt;
make PHP rock. And all these capabilities are going to be explored, in depth,&lt;br /&gt;
right here in this very series, if you can just find it in yourself to hang&lt;br /&gt;
around a little longer. So close your eyes, take a deep breath, and read on&lt;br /&gt;
to find out all about this tutorial’s topic: sessions and cookies.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading2&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Party Time&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Maybe you heard this at the last party you went to:&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;“HTTP is a stateless protocol,&lt;br /&gt;and the Internet is a stateless development environment”&lt;/i&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
No? Hmmm. Obviously, you don’t go to the right parties.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In simple language, all this means is that HTTP, the HyperText Transfer Protocol that&lt;br /&gt;
is the backbone of the Web, is unable to retain a memory of the identity of each client&lt;br /&gt;
that connects to a Web site, and therefore treats each request for a Web page as a unique&lt;br /&gt;
and independent connection, with no relationship whatsoever to the connections that preceded&lt;br /&gt;
it. This “stateless environment” works great so long as you’re aimlessly surfing the Web,&lt;br /&gt;
but it can cause a serious headache for sites that actually depend on the data accumulated&lt;br /&gt;
in previous requests. The most common example is that of an online shopping cart – in&lt;br /&gt;
a stateless environment, it becomes difficult to keep track of all the items you’ve&lt;br /&gt;
shortlisted for purchase as you jump from one catalog page to another.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Obviously, then, what is required is a method that makes it possible to “maintain state”,&lt;br /&gt;
allowing client connections to be tracked and connection-specific data to be maintained.&lt;br /&gt;
And thus came about&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;cookies&lt;/b&gt;, which allow Web sites to store client-specific information&lt;br /&gt;
on the client system, and access the information whenever required. A cookie is simply a&lt;br /&gt;
file, containing a series of variable-value pairs and linked to a domain. When a client&lt;br /&gt;
requests a particular domain, the values in the cookie file are read and imported into the&lt;br /&gt;
server environment, where a developer can read, modify and use them for different purposes.&lt;br /&gt;
A cookie is a convenient way to carry forward data from one client visit to the next.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Another common approach is to use a&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;session&lt;/b&gt;&amp;nbsp;to store connection-specific data; this&lt;br /&gt;
session data is preserved on the server for the duration of the visit, and is destroyed&lt;br /&gt;
on its conclusion. Sessions work by associating every session with a session ID (a unique&lt;br /&gt;
identifier for the session) that is automatically generated by PHP. This session ID is&lt;br /&gt;
stored in two places: on the client using a temporary cookie, and on the server in a&lt;br /&gt;
flat file or a database. By using the session ID to put a name to every request received,&lt;br /&gt;
a developer can identify which client initiated which request, and track and maintain&lt;br /&gt;
client-specific information in session variables (variable-value pairs which remain alive&lt;br /&gt;
for the duration of the session and which can store textual or numeric information).&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Sessions and cookies thus provide an elegant way to bypass the stateless nature of the HTTP&lt;br /&gt;
protocol, and are used on many of today’s largest sites to track and maintain information&lt;br /&gt;
for personal and commercial transactions. Typically, you use a session to store values that&lt;br /&gt;
are required over the course of a single visit, and a cookie to store more persistent data&lt;br /&gt;
that is used over multiple visits.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
PHP has included support for cookies since PHP 3.0, and built-in session management since&lt;br /&gt;
PHP 4.0. Both these features are enabled by default, so you don’t have to do anything&lt;br /&gt;
special to activate them. Instead, scroll down and take a look at your first session.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading3&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The First Session&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
One of the standard examples used to demonstrate how a session works is the hit counter&lt;br /&gt;
application. This is a simple counter that initializes a variable the first time you visit&lt;br /&gt;
a Web page, and increments it each time you reload the page. The counter variable is stored&lt;br /&gt;
in a session, which means that if you browse to another site and then return, the last&lt;br /&gt;
saved value of the counter will be restored (so long as you didn’t destroy the session&lt;br /&gt;
by shutting down the browser in the interim).&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Take a look at the code:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// initialize a session&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.session-start.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;session_start&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// increment a session counter&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;counter&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]++;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print value&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;You have viewed this page &quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;counter&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; times&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
To see how this works, request the script above through your browser a few times. You will&lt;br /&gt;
notice that the counter increases by 1 on each subsequent page load. If you open up two&lt;br /&gt;
browser windows and request the same page in each one, PHP will maintain and increment&lt;br /&gt;
individual session counters for each browser instance. The session ID is used to identify&lt;br /&gt;
which client made which request, and recreate the prior saved environment for each&lt;br /&gt;
individual session. This also means that if you visit one (or more) other Web sites during&lt;br /&gt;
the same session and then return to the script above without shutting down your browser&lt;br /&gt;
in the interim, your previous session will be retrieved and recreated for you.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Every session in PHP begins with a call to the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;session_start()&lt;/code&gt;&amp;nbsp;function. This&lt;br /&gt;
function checks to see whether a session already exists, and either restores it (if it does)&lt;br /&gt;
or creates a new one (if it doesn’t). Session variables can then be registered by adding keys&lt;br /&gt;
and values to the special&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION&lt;/code&gt;&amp;nbsp;superglobal array, and can be accessed at&lt;br /&gt;
any time during the session using standard array notation. In the example above, a key named&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;counter&lt;/code&gt;&amp;nbsp;has been added to the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION&lt;/code&gt;&amp;nbsp;array. The first time a&lt;br /&gt;
session is created, this key will have the value 0. On every subsequent request for the page&lt;br /&gt;
during the same session, the previous value of the counter will be retrieved and incremented by 1.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If the example above doesn’t work as advertised, check to make sure that the&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;session.save_path&lt;/code&gt;&amp;nbsp;variable in your php.ini file points to a valid temporary&lt;br /&gt;
directory for your system. This value is hard-wired to&amp;nbsp;&lt;span class=&quot;usernotes&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/tmp&lt;/span&gt;&lt;br /&gt;
by default, so if you’re trying the example on a Windows system, you will need to edit it to&lt;br /&gt;
&lt;span class=&quot;usernotes&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;C:\Windows\temp&lt;/span&gt;&amp;nbsp;(or your system’s temporary directory).&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading4&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Remember Me&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s another example, this one asking you to log in and then storing your login name and&lt;br /&gt;
session start time as two session variables. This information is then used to display the&lt;br /&gt;
total number of minutes the session has been active.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// initialize a session&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.session-start.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;session_start&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;lt;html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) &amp;amp;&amp;amp; !isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if no data, print the form&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;form action=&quot;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;PHP_SELF&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&quot; method=&quot;post&quot;&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type=&quot;text&quot; name=&quot;name&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Enter your name&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;br /&gt;&lt;br /&gt;else if (!isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) &amp;amp;&amp;amp; isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if a session does not exist but the form has been submitted&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// check to see if the form has all required values&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// create a new session&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!empty(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;];&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;start&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.time.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;time&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Welcome, &quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;. A new session has been activated for you. Click &amp;lt;a href=&quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;PHP_SELF&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;gt;here&amp;lt;/a&amp;gt; to refresh the page.&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ERROR: Please enter your name!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;else if (isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if a previous session exists&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// calculate elapsed time since session start and now&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Welcome back, &quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;. This session was activated &quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.round.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;round&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;((&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.time.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;time&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() -&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;start&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) /&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;60&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; minute(s) ago. Click &amp;lt;a href=&quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;PHP_SELF&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;gt;here&amp;lt;/a&amp;gt; to refresh the page.&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In this example, the presence or absence of a session variable is used to decide which&lt;br /&gt;
of the three possible screens to display. The session start time is also recorded in&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION[&#39;start&#39;]&lt;/code&gt;&amp;nbsp;with the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;time()&lt;/code&gt;&amp;nbsp;function, which returns&lt;br /&gt;
the total number of seconds between January 1 1970 and the current time. At a later&lt;br /&gt;
stage, the value stored in&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION[&#39;start&#39;]&lt;/code&gt;&amp;nbsp;is compared with the most&lt;br /&gt;
current value of&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;time()&lt;/code&gt;&amp;nbsp;to calculate and display an (approximate)&lt;br /&gt;
display of elapsed time.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
It’s important to note that the call to&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;session_start()&lt;/code&gt;&amp;nbsp;must appear first,&lt;br /&gt;
before any output is generated by the script (assuming you’re not using PHP’s output&lt;br /&gt;
buffering feature, which you can read about at&lt;br /&gt;
&lt;a href=&quot;http://www.php.net/manual/en/ref.outcontrol.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://www.php.net/manual/en/ref.outcontrol.php&lt;/a&gt;). This is because the PHP&lt;br /&gt;
session handler internally uses in-memory cookies to store session data, and the cookie&lt;br /&gt;
creation headers must be transmitted to the client browser before any output. If you ever&lt;br /&gt;
see an error like this in one of your session-enabled pages:&lt;/div&gt;
&lt;blockquote style=&quot;background-color: white; border-left-color: rgb(119, 119, 119); border-left-style: solid; border-width: 0px 0px 0px 2px; color: #777777; font-family: sans-serif; font-size: 14px; font-style: italic; line-height: 21px; margin: 5px auto 15px; outline: 0px; padding: 0px 10px; quotes: none; vertical-align: baseline; width: 460.6875px;&quot;&gt;
&lt;pre style=&quot;background-color: transparent; border: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Warning: Cannot send session cache limiter - headers already sent (output started at ...)
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
it’s usually because somewhere, somehow, some output has found its way to the browser before&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;session_start()&lt;/code&gt;&amp;nbsp;was called. Even a carriage return or a blank space outside the&lt;br /&gt;
PHP tags surrounding&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;session_start()&lt;/code&gt;&amp;nbsp;can cause this error, so watch out for them.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
As noted previously, every session has a unique session ID, which PHP uses to keep track of&lt;br /&gt;
different clients. This session ID is a long alphanumeric string, which is automatically&lt;br /&gt;
passed by PHP from page to page so that the continuity of the session is maintained. To see&lt;br /&gt;
what it looks like, use the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;session_id()&lt;/code&gt;&amp;nbsp;function, as in this simple example:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// initialize a session&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.session-start.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;session_start&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print session ID&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;I&#39;m tracking you with session ID &quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.session-id.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;session_id&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
When the user shuts down the client browser and destroys the session, the&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION&lt;/code&gt;&lt;br /&gt;
array will be flushed of all session variables. You can also explicitly destroy a session – for&lt;br /&gt;
example, when a user logs out – by calling the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;session_destroy()&lt;/code&gt;&amp;nbsp;function, as in&lt;br /&gt;
the following example:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// initialize a session&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.session-start.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;session_start&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// then destroy it&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.session-destroy.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;session_destroy&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In case you were wondering if you read that right – yes, before you can call&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;session_destroy()&lt;/code&gt;&amp;nbsp;to destroy a session, you must first call&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;session_start()&lt;/code&gt;&amp;nbsp;to recreate it.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Remember that&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION&lt;/code&gt;&amp;nbsp;is a superglobal, so you can use it inside&lt;br /&gt;
and outside functions without needing to declare it as global first. The following&lt;br /&gt;
simple example illustrates this:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// initialize a session&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.session-start.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;session_start&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// this function checks the value of a session variable&lt;br /&gt;&lt;br /&gt;// and returns true or false&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isAdmin&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] ==&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;admin&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set a value for $_SESSION[&#39;name&#39;]&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;guessme&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// call a function which uses a session variable&lt;br /&gt;&lt;br /&gt;// returns false here&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isAdmin&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set a new value for $_SESSION[&#39;name&#39;]&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;admin&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// call a function which uses a session variable&lt;br /&gt;&lt;br /&gt;// returns true here&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;isAdmin&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You can read more about sessions and session handling functions at&lt;br /&gt;
&lt;a href=&quot;http://www.php.net/manual/en/ref.session.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://www.php.net/manual/en/ref.session.php&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading5&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Rules Of The Game&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
A session works by using an in-memory cookie, which explains why it’s only active&lt;br /&gt;
while the browser instance that created it is active; once the browser instance is&lt;br /&gt;
terminated, the memory allocated to that instance is flushed and returned to the&lt;br /&gt;
system, destroying the session cookie in the process. If you want longer-lasting&lt;br /&gt;
cookies, you can use PHP’s built-in cookie functions to write data to the user’s&lt;br /&gt;
disk as a cookie file, and read this data back as and when needed.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Before you start using cookies, there are a few things you should be aware of:&lt;/div&gt;
&lt;ol style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; list-style: none; margin: 0px 0px 1.5em; outline: 0px; padding: 0px 0px 0px 30px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Since cookies are used to record information about your activities on a particular&lt;br /&gt;domain, they can only be read by the domain that created them&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;A single domain cannot set more than twenty cookies, and each cookie is limited&lt;br /&gt;to a maximum size of 4 KB&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;A cookie usually possesses six attributes, of which only the first is mandatory.&lt;br /&gt;Here they are:&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;ul style=&quot;background-color: transparent; border: 0px; list-style: none; margin: 0px 0px 1.5em; outline: 0px; padding: 0px 0px 0px 30px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name:&lt;/b&gt;&amp;nbsp;the name of the cookie&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;value:&lt;/b&gt;&amp;nbsp;the value of the cookie&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;expires:&lt;/b&gt;&amp;nbsp;the date and time at which the cookie expires&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;path:&lt;/b&gt;&amp;nbsp;the top-level directory on the domain from which cookie data can be accessed&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;domain:&lt;/b&gt;&amp;nbsp;the domain for which the cookie is valid&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;secure:&lt;/b&gt;&amp;nbsp;a Boolean flag indicating whether the cookie should be transmitted only&lt;br /&gt;over a secure HTTP connection&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
More information on cookies can be obtained from Netscape, the people who originally invented&lt;br /&gt;
them. Visit&amp;nbsp;&lt;a href=&quot;http://www.netscape.com/newsref/std/cookie_spec.html&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;&amp;lt;br&quot;&gt;&quot;_blank&quot;&amp;gt;http://www.netscape.com/newsref/std/cookie_spec.html&lt;/a&gt;&amp;nbsp;for the Netscape cookie&lt;br /&gt;
specification.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
It’s important to remember that, since cookies are stored on the user’s hard drive, you as&lt;br /&gt;
the developer have very little control over them. If a user decides to turn off cookie&lt;br /&gt;
support in his or her browser, your cookies will simply not be saved. Therefore, avoid&lt;br /&gt;
writing code that depends heavily on cookies; and have a backup plan ready in case cookie&lt;br /&gt;
data cannot be retrieved from the client.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
With that caveat out of the way, let’s look at some simple cookie-handling code in PHP.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading6&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Meeting Old Friends&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
PHP offers a single function for cookie manipulation:&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;setcookie()&lt;/code&gt;. This&lt;br /&gt;
function allows you to read and write cookie files, as demonstrated in the following example:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_COOKIE&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;visited&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if a cookie does not exist&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// set it&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.setcookie.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;setcookie&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;visited&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;1&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mktime.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mktime&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;()+&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;86400&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Could not set cookie&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;This is your first visit here today.&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if a cookie already exists&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Nice to see you again, old friend!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
To see how this works, request the page above through your browser a couple of times. The&lt;br /&gt;
first time around, because no cookie has yet been set, the first message will be displayed.&lt;br /&gt;
On all subsequent attempts, because the cookie has already been set, the client will be&lt;br /&gt;
recognized and the second message will be displayed. Note that this works even if you&lt;br /&gt;
terminate the browser instance, restart it and visit the page again – a marked difference&lt;br /&gt;
from what happened in the session examples you saw earlier.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;setcookie()&lt;/code&gt;&amp;nbsp;function accepts six arguments: the name of the cookie, its&lt;br /&gt;
value, its expiry date, the domain, the path for which it is valid, and a Boolean value&lt;br /&gt;
indicating its security state. As noted previously, only the name and value are mandatory,&lt;br /&gt;
although the example above specifies both a top-level directory and an expiry date for&lt;br /&gt;
the cookie (1 day) with the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mktime()&lt;/code&gt;&amp;nbsp;function, which works like the&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;time()&lt;/code&gt;&amp;nbsp;function described previously.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Cookie values are automatically sent to PHP from the client, and converted to key-value&lt;br /&gt;
pairs in the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_COOKIE&lt;/code&gt;&amp;nbsp;variable, a superglobal array similar to&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION&lt;/code&gt;. Values can then be retrieved using standard associative array&lt;br /&gt;
notation, as in the example above. Note that, as with sessions, calls to&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;setcookie()&lt;/code&gt;&amp;nbsp;must take place before any output is generated by the script,&lt;br /&gt;
or else you’ll see an error like this:&lt;/div&gt;
&lt;blockquote style=&quot;background-color: white; border-left-color: rgb(119, 119, 119); border-left-style: solid; border-width: 0px 0px 0px 2px; color: #777777; font-family: sans-serif; font-size: 14px; font-style: italic; line-height: 21px; margin: 5px auto 15px; outline: 0px; padding: 0px 10px; quotes: none; vertical-align: baseline; width: 460.6875px;&quot;&gt;
&lt;pre style=&quot;background-color: transparent; border: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Warning: Cannot add header information - headers already sent by (output started at ... )
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading7&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Form And Function&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s another, slightly more complex example:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;email&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if form has not been submitted&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// display form&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// if cookie already exists, pre-fill form field with cookie value&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;form action=&quot;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;PHP_SELF&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&quot; method=&quot;post&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Enter your email address: &amp;lt;input type=&quot;text&quot; name=&quot;email&quot; value=&quot;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_COOKIE&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;email&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;];&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&quot;&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type=&quot;submit&quot; name=&quot;submit&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// also calculate the time since the last submission&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_COOKIE&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;lastsave&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$days&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.round.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;round&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;((&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.time.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;time&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() -&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_COOKIE&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;lastsave&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) /&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;86400&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;br /&amp;gt; $days day(s) since last submission&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;br /&gt;&lt;br /&gt;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if form has been submitted&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// set cookies with form value and timestamp&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// both cookies expire after 30 days&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!empty(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;email&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.setcookie.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;setcookie&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;email&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;email&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;],&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mktime.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mktime&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;()+(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;86400&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;),&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.setcookie.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;setcookie&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;lastsave&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.time.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;time&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(),&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mktime.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mktime&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;()+(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;86400&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;),&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Your email address has been recorded.&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ERROR: Please enter your email address!&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In this case, the value entered into the form is stored as a cookie called email, and&lt;br /&gt;
automatically retrieved to pre-fill the form field on all subsequent requests. This&lt;br /&gt;
technique is frequently used by Web sites that require the user to enter a login name&lt;br /&gt;
and password; by automatically pre-filling the username field in the login box with the&lt;br /&gt;
value used in the last successful attempt, they save the user a few keystrokes.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
This example also demonstrates how you can set more than one cookie for a domain, by&lt;br /&gt;
calling&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;setcookie()&lt;/code&gt;&amp;nbsp;multiple times. In the example above, the time at which&lt;br /&gt;
the data was entered is stored as a second cookie, and used to calculate the time elapsed&lt;br /&gt;
between successive entries.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
To remove a cookie from the client, simply call&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;setcookie()&lt;/code&gt;&amp;nbsp;with the same&lt;br /&gt;
syntax you used to originally set the cookie, but an expiry date in the past. This will&lt;br /&gt;
cause the cookie to be removed from the client system. Here’s an example:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// delete cookie&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.setcookie.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;setcookie&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;lastsave&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mktime.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mktime&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() -&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;3600&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Read more about cookies and the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;setcookie()&lt;/code&gt;&amp;nbsp;function at&lt;a href=&quot;http://www.php.net/manual/en/features.cookies.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://www.php.net/manual/en/features.cookies.php&lt;/a&gt;&amp;nbsp;and&lt;a href=&quot;http://www.php.net/manual/en/function.setcookie.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://www.php.net/manual/en/function.setcookie.php&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading8&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Access Granted&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
As I said at the beginning of this tutorial, cookies and sessions are two different ways&lt;br /&gt;
of making data “persistent” on the client. A session retains data for the duration of the&lt;br /&gt;
session, while a cookie retains values for as long as you need it to. With that in mind,&lt;br /&gt;
let’s now look at an example that uses them both.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The application here is a simple user authentication system, where certain pages can only&lt;br /&gt;
be viewed by users who successfully log in to the system. Users who have not been&lt;br /&gt;
authenticated with a valid password are denied access to these “special” pages. The list&lt;br /&gt;
of valid usernames and passwords is stored in a MySQL database, and PHP is used to verify&lt;br /&gt;
a user’s credentials and decide whether or not to grant access.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Assuming the MySQL database table looks like this&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;+-------+-----------------------------------------------+
| name  | pass                                          |
+-------+-----------------------------------------------+
| sue   | 9565d44fd0fe4db59f073eea1db70f3ea258e10b      |
| harry | 6e74234b8b552685113b53c7bff0f386c8cef8cf      |
| louis | 6817dda51b64b8190029490d2811a4d9cb9cd432      |
| sam   | bd17f8243e771a57cfbb06aa9a82bbf09fd2d90b      |
| james | 792ec9b44d432c947ac6775b2b52326e9d08512f      |
+-------+-----------------------------------------------+
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
with a unique username field and a password field created with the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SHA1()&lt;/code&gt;&amp;nbsp;function,&lt;br /&gt;
here’s the PHP script that does all the hard work:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) || isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;pass&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// form submitted&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// check for required values&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (empty(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die (&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ERROR: Please enter username!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (empty(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;pass&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ERROR: Please enter password!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set server access variables&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;localhost&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;db2&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open connection&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysql-connect.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysql_connect&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to connect!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// select database&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysql-select-db.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysql_select_db&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to select database!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create query&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT * FROM users WHERE name = &#39;&quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&#39; AND pass =&amp;nbsp;&lt;a href=&quot;http://devzone.zend.com/manual/function.sha1.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;SHA1&lt;/a&gt;(&#39;&quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;pass&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] .&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&#39;)&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysql-query.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysql_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: $query. &quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysql-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysql_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;());&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// see if any rows were returned&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysql-num-rows.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysql_num_rows&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) ==&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if a row was returned&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// authentication was successful&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// create session and set cookie with username&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.session-start.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;session_start&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;auth&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.setcookie.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;setcookie&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;username&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;name&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;],&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.time.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;time&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;()+(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;84600&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Access granted!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// no result&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// authentication failed&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ERROR: Incorrect username or password!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// free result set memory&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysql-free-result.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysql_free_result&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close connection&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysql-close.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysql_close&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// no submission&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// display login form&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;form method=&quot;post&quot; action=&quot;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;PHP_SELF&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;];&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Username &amp;lt;input type=&quot;text&quot; name=&quot;name&quot; value=&quot;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_COOKIE&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;username&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;];&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&quot;&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;p /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Password &amp;lt;input type=&quot;password&quot; name=&quot;pass&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;p /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Log In&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here, the values entered into the login box are integrated into a MySQL SELECT query, which&lt;br /&gt;
is executed on the user table. If both username and password match, a single record will be&lt;br /&gt;
returned, indicating that authentication succeeded; if they don’t, no records will be&lt;br /&gt;
returned, indicating that authentication failed.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Assuming authentication succeeds, a session is initialized, the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION[&#39;auth&#39;]&lt;/code&gt;&lt;br /&gt;
key is created and assigned a value of Boolean&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;true&lt;/code&gt;, and the username is stored&lt;br /&gt;
in a cookie for next time. The cookie will remain valid for 30 days, and will be used to&lt;br /&gt;
pre-fill the username field in the login box on the next login attempt.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Of course, this isn’t enough by itself. While the script above performs authentication and&lt;br /&gt;
initializes both a session and a cookie if the user’s credentials are validated, a security&lt;br /&gt;
check must also be carried out on each of the restricted pages. Without this check, any user&lt;br /&gt;
could bypass the login screen and simply type in the exact URL to each page to view it.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Since it is clear from the previous script that the session variable&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION[&#39;auth&#39;]&lt;/code&gt;&lt;br /&gt;
can only exist if the user’s credentials have been validated, it suffices to check for the&lt;br /&gt;
presence of the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION[&#39;auth&#39;]&lt;/code&gt;&amp;nbsp;variable at the top of each restricted page,&lt;br /&gt;
and grant access if that check returns true. Here’s how:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// start session&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.session-start.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;session_start&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;br /&gt;&lt;br /&gt;if (!&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;auth&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] ==&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check if authentication was performed&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// else die with error&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ERROR: Unauthorized access!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;else {&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;This is a secure page. You can only see this if $_SESSION[&#39;auth&#39;] = 1&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Pretty neat, huh? Only authenticated users will be able to see this page, because only&lt;br /&gt;
their clients will have a session with the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SESSION[&#39;auth&#39;]&lt;/code&gt;&amp;nbsp;variable in it.&lt;br /&gt;
Everyone else will simply see an error message.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/1372455101388149101/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-10-session-in-cookie-jar.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/1372455101388149101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/1372455101388149101'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-10-session-in-cookie-jar.html' title='PHP 101 (part 10): A Session In The Cookie Jar'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s72-c/php_mysql_logo.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-6426996395529046710</id><published>2013-11-01T13:10:00.001-07:00</published><updated>2013-11-01T19:02:20.692-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP 101 (PART 9): SQLITE MY FIRE! – PART 2"/><title type='text'>PHP 101 (PART 9): SQLITE MY FIRE! – PART 2</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s1600/php_mysql_logo.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;185&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s320/php_mysql_logo.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/h2&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Not My Type&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Whilst on the topic of&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;INSERT&lt;/code&gt;, remember my statement a couple pages&lt;br /&gt;
back about how SQLite is typeless and so you can insert values of any&lt;br /&gt;
type into any field? There is one important exception to this rule: a&lt;br /&gt;
field marked as&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;INTEGER PRIMARY KEY&lt;/code&gt;. In SQLite, fields marked as&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;INTEGER PRIMARY KEY&lt;/code&gt;&amp;nbsp;do two important things: they provide a unique&lt;br /&gt;
numeric identifier for each record in the table, and if you insert a&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;NULL&lt;/code&gt;&amp;nbsp;value into them, SQLite automatically inserts a value that is 1&lt;br /&gt;
greater than the largest value already present in that field.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;INTEGER PRIMARY KEY&lt;/code&gt;&amp;nbsp;fields in SQLite thus perform the equivalent of&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;AUTO_INCREMENT&lt;/code&gt;&amp;nbsp;fields in MySQL, and are a convenient way of&lt;br /&gt;
automatically numbering your records. Obviously, you can’t insert&lt;br /&gt;
non-numeric values into such a field, which is why I said they were an&lt;br /&gt;
exception to the typeless rule. Read more about this at&lt;br /&gt;
&lt;a href=&quot;http://www.sqlite.org/datatypes.html&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;http://www.sqlite.org/datatypes.html&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Since the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;books&lt;/code&gt;&amp;nbsp;table used in the previous example already contains&lt;br /&gt;
such a field (the id field), it’s clear that every&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;INSERT&lt;/code&gt;&amp;nbsp;into it with a&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;NULL&lt;/code&gt;&amp;nbsp;value for that field generates a new record number. If you’d like&lt;br /&gt;
to retrieve this number, PHP has a way to do that too – just use the&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_last_insert_rowid()&lt;/code&gt;&amp;nbsp;function, which returns the ID of the&lt;br /&gt;
last inserted row (equivalent to the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_insert_id()&lt;/code&gt;&amp;nbsp;function&lt;br /&gt;
in PHP’s MySQL API).&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
To see this in action, update the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if()&lt;/code&gt;&amp;nbsp;loop in the middle of the&lt;br /&gt;
previous script to include a call to&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_last_insert_rowid()&lt;/code&gt;, as&lt;br /&gt;
follows:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check to see if the form was submitted with a new record&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;submit&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// make sure both title and author are present&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!empty(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;title&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) &amp;amp;&amp;amp; !empty(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;author&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// generate INSERT query&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$insQuery&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;INSERT INTO books (title, author) VALUES (\&quot;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-escape-string.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_escape_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;title&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]).&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;\&quot;, \&quot;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-escape-string.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_escape_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;author&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]).&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;\&quot;)&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$insResult&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-query.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$insQuery&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-error-string.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_error_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-last-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_last_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print success message&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;i&amp;gt;Record successfully inserted with ID &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-last-insert-rowid.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_last_insert_rowid&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;).&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;!&amp;lt;/i&amp;gt;&amp;lt;p /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// missing data&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// display error message&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;i&amp;gt;Incomplete form input. Record not inserted!&amp;lt;/i&amp;gt;&amp;lt;p /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If you need to, you can also find out how many rows were affected using&lt;br /&gt;
the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_changes()&lt;/code&gt;&amp;nbsp;function – try it for yourself and see!&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading8&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Starting From Scratch&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You’ll remember, from the beginning of this tutorial, that I suggested&lt;br /&gt;
you initialize the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;library.db&lt;/code&gt;&amp;nbsp;database using the SQLite&lt;br /&gt;
commandline program. Well, that isn’t the only way to create a fresh&lt;br /&gt;
SQLite database – you can use PHP itself to do this, by issuing the&lt;br /&gt;
necessary&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;CREATE TABLE&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;INSERT&lt;/code&gt;&amp;nbsp;commands&lt;br /&gt;
through the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_query()&lt;/code&gt;&amp;nbsp;function. Here’s how:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set path of database file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;DOCUMENT_ROOT&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/../library2.db&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open database file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-open.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_open&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Could not open database&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create database&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-query.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;CREATE TABLE books (id INTEGER PRIMARY KEY, title VARCHAR(255) NOT NULL, author VARCHAR(255) NOT NULL)&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-error-string.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_error_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-last-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_last_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// insert records&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-query.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;INSERT INTO books (title, author) VALUES (&#39;The Lord Of The Rings&#39;, &#39;J.R.R. Tolkien&#39;)&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-error-string.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_error_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-last-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_last_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-query.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;INSERT INTO books (title, author) VALUES (&#39;The Murders In The Rue Morgue&#39;, &#39;Edgar Allan Poe&#39;)&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-error-string.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_error_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-last-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_last_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-query.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;INSERT INTO books (title, author) VALUES (&#39;Three Men In A Boat&#39;, &#39;Jerome K. Jerome&#39;)&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-error-string.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_error_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-last-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_last_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-query.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;INSERT INTO books (title, author) VALUES (&#39;A Study In Scarlet&#39;, &#39;Arthur Conan Doyle&#39;)&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-error-string.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_error_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-last-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_last_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-query.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;INSERT INTO books (title, author) VALUES (&#39;Alice In Wonderland&#39;, &#39;Lewis Carroll&#39;)&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-error-string.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_error_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-last-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_last_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print success message&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;i&amp;gt;Database successfully initialized!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// all done&lt;br /&gt;&lt;br /&gt;// close database file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-close.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_close&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Or, in PHP 5, you can use the object-oriented approach:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set path of database file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;DOCUMENT_ROOT&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/../library3.db&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create database object&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SQLiteDatabase&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Could not open database&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create database&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;CREATE TABLE books (id INTEGER PRIMARY KEY, title VARCHAR(255) NOT NULL, author VARCHAR(255) NOT NULL)&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// insert records&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;INSERT INTO books (title, author) VALUES (&#39;The Lord Of The Rings&#39;, &#39;J.R.R. Tolkien&#39;)&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;INSERT INTO books (title, author) VALUES (&#39;The Murders In The Rue Morgue&#39;, &#39;Edgar Allan Poe&#39;)&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;INSERT INTO books (title, author) VALUES (&#39;Three Men In A Boat&#39;, &#39;Jerome K. Jerome&#39;)&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;INSERT INTO books (title, author) VALUES (&#39;A Study In Scarlet&#39;, &#39;Arthur Conan Doyle&#39;)&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;INSERT INTO books (title, author) VALUES (&#39;Alice In Wonderland&#39;, &#39;Lewis Carroll&#39;)&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print success message&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;i&amp;gt;Database successfully initialized!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// all done&lt;br /&gt;&lt;br /&gt;// destroy database object&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;unset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading9&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
A Few Extra Tools&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Finally, the SQLite API also includes some ancillary functions, to&lt;br /&gt;
provide you with information on the SQLite version and encoding, and on&lt;br /&gt;
the error code and message generated by the last failed operation. The&lt;br /&gt;
following example demonstrates the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_libversion()&lt;/code&gt;&amp;nbsp;and&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_libencoding()&lt;/code&gt;&amp;nbsp;functions, which return the version number&lt;br /&gt;
and encoding of the linked SQLite library respectively:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// version&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SQLite version: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-libversion.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_libversion&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// encoding&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SQLite encoding: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-libencoding.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_libencoding&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
When things go wrong, reach for the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_last_error()&lt;/code&gt;&lt;br /&gt;
function, which returns the last error code returned by SQLite. Of&lt;br /&gt;
course, this error code – a numeric value – is not very useful in&lt;br /&gt;
itself; to convert it to a human-readable message, couple it with the&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_error_string()&lt;/code&gt;&amp;nbsp;function. Consider the following&lt;br /&gt;
example, which illustrates by attempting to run a query with a&lt;br /&gt;
deliberate error in it:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set path of database file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;DOCUMENT_ROOT&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/../library.db&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open database file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-open.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_open&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Could not open database&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// generate query string&lt;br /&gt;&lt;br /&gt;// query contains a deliberate error&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;DELETE books WHERE id = 1&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-query.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-error-string.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_error_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-last-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_last_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// all done&lt;br /&gt;&lt;br /&gt;// close database file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-close.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_close&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s what the output looks like:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;img alt=&quot;A Few Extra Tools&quot; src=&quot;http://devzone.zend.com/images/articles/vikram9_4.gif&quot; style=&quot;background-color: #f8f8f4; border: 1px solid rgb(230, 230, 230); margin: 0px 0px 10px; outline: 0px; padding: 2px; vertical-align: baseline;&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Note that although they might appear similar, the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_last_error()&lt;/code&gt;&lt;br /&gt;
and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_error_string()&lt;/code&gt;&amp;nbsp;functions don’t work in exactly the same way&lt;br /&gt;
as the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_errno()&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_error()&lt;/code&gt;&amp;nbsp;functions. The&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_errno()&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_error()&lt;/code&gt;&amp;nbsp;functions&lt;br /&gt;
can be used independently of each other to retrieve the last error code&lt;br /&gt;
and message respectively, but the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_error_string()&lt;/code&gt;&amp;nbsp;is dependent&lt;br /&gt;
on the error code returned by&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_last_error()&lt;/code&gt;.&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/6426996395529046710/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-9-sqlite-my-fire-part-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/6426996395529046710'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/6426996395529046710'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-9-sqlite-my-fire-part-2.html' title='PHP 101 (PART 9): SQLITE MY FIRE! – PART 2'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s72-c/php_mysql_logo.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-7350339948976550807</id><published>2013-11-01T13:09:00.000-07:00</published><updated>2013-11-01T13:09:04.468-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP 101 (part 9): SQLite My Fire! – Part 1"/><title type='text'>PHP 101 (part 9): SQLite My Fire! – Part 1</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s1600/php_mysql_logo.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;185&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s320/php_mysql_logo.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/h2&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Hard Choices&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If you’ve been paying attention, you now know how to use PHP’s MySQL&lt;br /&gt;API to perform queries and process result sets. You might even have&lt;br /&gt;started thinking about how to re-program your site to run off a MySQL&lt;br /&gt;database. All of this is a Good Thing – it means you’re getting&lt;br /&gt;comfortable with using PHP’s database support to power your&lt;br /&gt;applications – but there’s still a little further to go.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
As you saw in&amp;nbsp;Part Eight, enabling&lt;br /&gt;MySQL support in PHP 5.0 is not as simple as&lt;br /&gt;it used to be. Instead of supporting MySQL out of the box, PHP now&lt;br /&gt;requires you to make all kinds of decisions about versions and&lt;br /&gt;libraries before allowing you to hook your scripts up to a MySQL&lt;br /&gt;database. If you’re lazy (and deep down, we both know you are), you&lt;br /&gt;might instead prefer to try a simpler option: the SQLite database engine.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Built-in SQLite support is new to PHP 5.0, and offers users a&lt;br /&gt;lightweight database system that is fast, efficient and gets the&lt;br /&gt;job done. Since it’s enabled by default in PHP 5.0, it provides a&lt;br /&gt;viable alternative to MySQL; you can use it out of the box, without&lt;br /&gt;spending time on version checks and library downloads; just install PHP 5&lt;br /&gt;and start typing. That’s why I’m devoting a whole tutorial to it -&lt;br /&gt;so get out of bed, make yourself some coffee and let’s get started!&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading2&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Making New Friends&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Before getting into the code, let’s make sure that you have a clear&lt;br /&gt;idea of what SQLite is (and isn’t). Unlike MySQL, which operates on a&lt;br /&gt;client-server paradigm, SQLite is a file-based database engine and uses&lt;br /&gt;file I/O (input/output) functions to store and read databases from&lt;br /&gt;files on disk. It’s also much, much smaller than MySQL – the&lt;br /&gt;command-line version of SQLite weighs in at under 200 KB – and&lt;br /&gt;supports most of the SQL commands you’re used to.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
This small size shouldn’t deceive you, however – according to&lt;br /&gt;&lt;a href=&quot;http://sqlite.org/&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;the official SQLite Web site&lt;/a&gt;,&lt;br /&gt;SQLite supports databases up to 2 terabytes in size and is actually&lt;br /&gt;faster than MySQL in certain situations. SQLite database files are easily&lt;br /&gt;portable, and SQLite databases created on Windows work fine on *NIX&lt;br /&gt;platforms and vice-versa.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
One of SQLite’s more interesting aspects is that it is completely&lt;br /&gt;typeless. Fields in an SQLite database need not be&lt;br /&gt;associated with a specific type, and even if they are, you can still&lt;br /&gt;insert values of different types into them (there is one exception to&lt;br /&gt;this rule, but I’ll get to that later). This is important, because it&lt;br /&gt;means that if you’re concerned about values of the wrong type getting&lt;br /&gt;into your tables, you need to write code to implement type checking in&lt;br /&gt;your application.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Another important difference between MySQL and SQLite lies in their&lt;br /&gt;licensing policies: unlike MySQL, SQLite source code is completely&lt;br /&gt;public-domain, which means that you can use and distribute it however&lt;br /&gt;you choose in both commercial and non-commercial products. Take a look at&lt;br /&gt;&lt;a href=&quot;http://sqlite.org/copyright.html&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://sqlite.org/copyright.html&lt;/a&gt;&lt;br /&gt;for more on this.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In order to use SQLite and PHP together, your PHP build must include&lt;br /&gt;SQLite. This is enabled by default in both the UNIX and Windows versions&lt;br /&gt;of PHP 5. Read more about this at&lt;br /&gt;&lt;a href=&quot;http://www.php.net/manual/en/ref.sqlite.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://www.php.net/manual/en/ref.sqlite.php&lt;/a&gt;.&lt;br /&gt;If you’re a PHP 4.x user, though, don’t lose heart – you can still use SQLite,&lt;br /&gt;by manually downloading and installing php_sqlite.dll from&lt;br /&gt;&lt;a href=&quot;http://snaps.php.net/win32/PECL_STABLE/&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://snaps.php.net&lt;/a&gt;&lt;br /&gt;(Windows) or the latest tarball from&amp;nbsp;&lt;a href=&quot;http://devzone.zend.com/14/php-101-part-9-sqlite-my-fire_part-1/%3Cbr&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;&quot;http://pecl.php.net/package/SQLite&quot; target=&quot;_blank&quot;&amp;gt;http://pecl.php.net/package/SQLite&lt;/a&gt;&lt;br /&gt;(UNIX). You don’t need to download anything else; the SQLite ‘client’ is its own engine.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading3&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The Bookworm Turns&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
As with MySQL, you use regular SQL commands to interact with an&lt;br /&gt;SQLite database. The exact SQL syntax used by SQLite is listed&lt;br /&gt;at&amp;nbsp;&lt;a href=&quot;http://sqlite.org/lang.html&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://sqlite.org/lang.html&lt;/a&gt;,&lt;br /&gt;but for most operations SQL commands are standard.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s an example, which sets up the table I’ll be using in this&lt;br /&gt;tutorial:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;C:\WINDOWS\Desktop\sqlite&amp;gt;sqlite library.db&lt;br /&gt;&lt;br /&gt;SQLite version 2.8.15&lt;br /&gt;&lt;br /&gt;Enter &quot;.help&quot; for instructions&lt;br /&gt;&lt;br /&gt;sqlite&amp;gt; create table books (&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;...&amp;gt; id integer primary key,&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&amp;gt; title varchar(255) not null,&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&amp;gt; author varchar(255) not null&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;...&amp;gt;);&lt;br /&gt;&lt;br /&gt;sqlite&amp;gt; insert into books (title, author) values (&#39;The Lord Of The Rings&#39;, &#39;J.R.R. Tolkien&#39;);&lt;br /&gt;&lt;br /&gt;sqlite&amp;gt; insert into books (title, author) values (&#39;The Murders In The Rue Morgue&#39;, &#39;Edgar Allen Poe&#39;);&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite&amp;gt; insert into books (title, author) values (&#39;Three Men In A Boat&#39;, &#39;Jerome K. Jerome&#39;);&lt;br /&gt;&lt;br /&gt;sqlite&amp;gt; insert into books (title, author) values (&#39;A Study In Scarlet&#39;, &#39;Arthur Conan Doyle&#39;);&lt;br /&gt;&lt;br /&gt;sqlite&amp;gt; insert into books (title, author) values (&#39;Alice In Wonderland&#39;, &#39;Lewis Carroll&#39;);&lt;br /&gt;&lt;br /&gt;sqlite&amp;gt; .exit&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You can enter these commands either interactively or&lt;br /&gt;non-interactively through the SQLite commandline program,&lt;br /&gt;which is available at&amp;nbsp;&lt;a href=&quot;http://devzone.zend.com/14/php-101-part-9-sqlite-my-fire_part-1/%3Cbr&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;&quot;http://sqlite.org/download.html&quot; target=&quot;_blank&quot;&amp;gt;http://sqlite.org/download.html&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
as a precompiled binary for Windows and Linux. SQLite 2.* is the&lt;br /&gt;version currently used in both branches of PHP, with SQLite 3.* support&lt;br /&gt;anticipated for PDO and later PHP 5.* releases.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Extract the downloaded files to a directory of your choice, cd into it from&lt;br /&gt;your shell or DOS box and type ‘sqlite’. You should see the SQLite version&lt;br /&gt;information and the line:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Enter &quot;.help&quot; for instructions&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Read&lt;br /&gt;&lt;a href=&quot;http://sqlite.org/sqlite.html&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://sqlite.org/sqlite.html&lt;/a&gt;&lt;br /&gt;for more information on how to use the commandline program.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Once the data has been imported into the database file&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;library.db&lt;/code&gt;, run a quick&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SELECT&lt;/code&gt;&lt;br /&gt;query to check if everything is working as it should:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;sqlite&amp;gt; select * from books;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1|The Lord Of The Rings|J.R.R. Tolkien
2|The Murders In The Rue Morgue|Edgar Allen Poe
3|Three Men In A Boat|Jerome K. Jerome
4|A Study In Scarlet|Arthur Conan Doyle
5|Alice In Wonderland|Lewis Carroll
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If you saw the same output as above, you’re good to go!&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading4&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Anatomy Class&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Now, use PHP to communicate with SQLite, generate the same result&lt;br /&gt;set and format it as an HTML page. Here’s the code:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set path of database file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;DOCUMENT_ROOT&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/../library.db&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open database file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-open.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_open&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Could not open database&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// generate query string&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT * FROM books&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-query.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-error-string.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_error_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-last-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_last_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if rows exist&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-num-rows.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_num_rows&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get each row as an array&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// print values&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;table cellpadding=10 border=1&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while(&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-fetch-array.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_fetch_array&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/table&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// all done&lt;br /&gt;&lt;br /&gt;// close database file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-close.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_close&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If all goes well, you should see something like this:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;img alt=&quot;Anatomy Class&quot; src=&quot;http://devzone.zend.com/images/articles/vikram9_1.gif&quot; style=&quot;background-color: #f8f8f4; border: 1px solid rgb(230, 230, 230); margin: 0px 0px 10px; outline: 0px; padding: 2px; vertical-align: baseline;&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If you remember what you learned in&amp;nbsp;&lt;a href=&quot;http://devzone.zend.com/14/php-101-part-9-sqlite-my-fire_part-1/php101-8.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;Part Eight&lt;/a&gt;,&lt;br /&gt;the PHP script above should be easy to decipher. In case you don’t, here’s a fast rundown:&lt;/div&gt;
&lt;ol style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; list-style: none; margin: 0px 0px 1.5em; outline: 0px; padding: 0px 0px 0px 30px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;The ball starts rolling with the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_open()&lt;/code&gt;&amp;nbsp;function, which&lt;br /&gt;accepts the name of the database file as argument and attempts to open&lt;br /&gt;it. If this database file cannot be found, an empty database file will&lt;br /&gt;be created with the supplied name (assuming the script has write access&lt;br /&gt;to the directory).&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
$db&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;DOCUMENT_ROOT&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/../library.db&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-open.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_open&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Could not open database&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;/code&gt;&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The database file&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;library.db&lt;/code&gt;&amp;nbsp;needs to be kept somewhere it&lt;br /&gt;can’t be accessed through the browser by visitors to your site. That&lt;br /&gt;means that you need to create it outside your public_html, www or&lt;br /&gt;htdocs directory, in a directory that allows your scripts read/write&lt;br /&gt;permissions. Web hosting companies generally will offer a space above&lt;br /&gt;your web-visible directory where you can do this.&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER[&#39;DOCUMENT_ROOT&#39;].&quot;/..&quot;&lt;/code&gt;&amp;nbsp;is the directory&lt;br /&gt;directly above your web-visible directory.&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If successful, the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_open()&lt;/code&gt;&amp;nbsp;function returns a handle&lt;br /&gt;to the file, which is stored in the variable&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/code&gt;&amp;nbsp;and&lt;br /&gt;is used for all subsequent communication with the database.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;The next step is to create and execute the query, with the&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_query()&lt;/code&gt;&amp;nbsp;function.&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
$query&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT * FROM books&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-query.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: &quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-error-string.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_error_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-last-error.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_last_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)));&lt;/span&gt;&lt;/div&gt;
&lt;/code&gt;&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
This function also needs two parameters: the database handle and the&lt;br /&gt;query string. Depending on whether or not the query was successful, the&lt;br /&gt;function returns true or false; in the event of a failure, the&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_error_string()&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_last_error()&lt;/code&gt;&lt;br /&gt;functions can be used to display the error that took place.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;If&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_query()&lt;/code&gt;&amp;nbsp;is successful, the result set returned by the&lt;br /&gt;query is stored in the variable&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/code&gt;. You can retrieve the records&lt;br /&gt;in the result set with the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_fetch_array()&lt;/code&gt;&amp;nbsp;function, which&lt;br /&gt;fetches a single row of data as an array called&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/code&gt;. Fields in that&lt;br /&gt;record are represented as array elements, and can be accessed using&lt;br /&gt;standard index notation.&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Each time you call&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_fetch_array()&lt;/code&gt;, the next record in the&lt;br /&gt;result set is returned. This makes&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_fetch_array()&lt;/code&gt;&amp;nbsp;very suitable&lt;br /&gt;for use in a&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;while()&lt;/code&gt;&amp;nbsp;loop, in much the same way as&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_fetch_row()&lt;/code&gt;&amp;nbsp;was used earlier.&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-num-rows.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_num_rows&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;table cellpadding=10 border=1&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-fetch-array.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_fetch_array&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/table&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/code&gt;&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The number of records returned by the query can be retrieved with&lt;br /&gt;the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_num_rows()&lt;/code&gt;&amp;nbsp;function. Or, if what you’re really interested in&lt;br /&gt;is the number of fields in the result set, use the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_num_fields()&lt;/code&gt;&lt;br /&gt;function instead. Of course, these are only applicable with queries&lt;br /&gt;that actually return records; it doesn’t really make sense to use them&lt;br /&gt;with&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;INSERT&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;UPDATE&lt;/code&gt;&amp;nbsp;or&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;DELETE&lt;/code&gt;&amp;nbsp;queries.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Once you’re done, it’s a good idea to close the database handle and return&lt;br /&gt;the used memory to the system, with a call to&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_close()&lt;/code&gt;:&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
sqlite_close&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;/code&gt;&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In PHP 5 you can also use the SQLite API in an object-oriented way,&lt;br /&gt;wherein each of the functions above becomes a method of the&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SQLiteDatabase()&lt;/code&gt;&amp;nbsp;object. Take a look at this next listing,&lt;br /&gt;which is equivalent to the one above:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set path of database file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;DOCUMENT_ROOT&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/../library.db&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create database object&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SQLiteDatabase&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Could not open database&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// generate query string&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT *&amp;nbsp;&amp;nbsp;FROM books&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;br /&gt;&lt;br /&gt;// return result object&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if rows exist&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;numRows&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get each row as an array&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// print values&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;table cellpadding=10 border=1&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while(&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fetch&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;()) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/table&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// all done&lt;br /&gt;&lt;br /&gt;// destroy database object&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;unset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here, the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;new&lt;/code&gt;&amp;nbsp;keyword is used to instantiate an object&lt;br /&gt;of the class&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SQLiteDatabase()&lt;/code&gt;&amp;nbsp;by passing the object&lt;br /&gt;constructor the name of the database file. If the database file does&lt;br /&gt;not already exist, a new database file is created. The resulting object,&lt;br /&gt;stored in&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/code&gt;, then exposes methods and properties to&lt;br /&gt;perform queries. Every query returns an instance of the class&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SQLiteResult()&lt;/code&gt;, which in turn exposes methods for&lt;br /&gt;fetching and processing records.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If you look closely at the two scripts above, you’ll see the numerous&lt;br /&gt;similarities between the procedural function names and the object method&lt;br /&gt;names. While the correspondence between the two is not perfect, it’s&lt;br /&gt;usually close enough to make it possible to guess the one if you know the other.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading5&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Different Strokes&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
As with the MySQL API, PHP’s SQLite API offers you more than one way to&lt;br /&gt;skin a cat. For example, you can retrieve each row as an object with the&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_fetch_object()&lt;/code&gt;&amp;nbsp;method, and access field values&lt;br /&gt;by using the field names as object properties. Here’s an example:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set path of database file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;DOCUMENT_ROOT&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/../library.db&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open database file&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-open.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_open&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Could not open database&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// generate query string&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT * FROM books&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-query.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-error-string.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_error_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-last-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_last_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if rows exist&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-num-rows.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_num_rows&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get each row as an object&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// print field values as object properties&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;table cellpadding=10 border=1&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while(&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$obj&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-fetch-object.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_fetch_object&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$obj&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$obj&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$obj&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;author&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/table&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// all done&lt;br /&gt;&lt;br /&gt;// close database file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-close.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_close&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Another option is to retrieve the complete result set in one fell&lt;br /&gt;swoop with the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_fetch_all()&lt;/code&gt;&amp;nbsp;function. This function&lt;br /&gt;retrieves the complete set of records as an array of arrays; each&lt;br /&gt;element of the outer array represents a record, and is itself&lt;br /&gt;structured as an array whose elements represent fields in that record.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s an example, which might make this clearer:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set path of database file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;DOCUMENT_ROOT&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/../library.db&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open database file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-open.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_open&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Could not open database&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// generate query string&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT * FROM books&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-query.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-error-string.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_error_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-last-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_last_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get the complete result set as a series of nested arrays&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-fetch-all.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_fetch_all&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// all done&lt;br /&gt;&lt;br /&gt;// close database file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-close.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_close&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check the array to see if it contains at least one record&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sizeof.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sizeof&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;table cellpadding=10 border=1&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// iterate over outer array (rows)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// print values for each element of inner array (columns)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;foreach (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/table&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In all the previous examples, the database remained open while the&lt;br /&gt;result set was processed, because records were retrieved one after&lt;br /&gt;another with the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_fetch_array()&lt;/code&gt;&amp;nbsp;or&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_fetch_object()&lt;/code&gt;&amp;nbsp;functions. The example above is unique&lt;br /&gt;in that the database can be closed before the result set array is processed.&lt;br /&gt;This is because the entire result set is retrieved at once and stored in the&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&lt;/code&gt;&amp;nbsp;array, so there really isn’t any need to leave the database&lt;br /&gt;open while processing it.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If your result set contains only a single field, use the&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_fetch_single()&lt;/code&gt;function, which retrieves the value of the first&lt;br /&gt;field of a row. The PHP manual puts it best when it says “this is the&lt;br /&gt;most optimal way to retrieve data when you are only interested in the&lt;br /&gt;values from a single column of data.” Take a look:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set path of database file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;DOCUMENT_ROOT&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/../library.db&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open database file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-open.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_open&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Could not open database&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// generate query string&lt;br /&gt;&lt;br /&gt;// this query returns only a single record with a single field&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT author FROM books WHERE title = &#39;A Study In Scarlet&#39;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-query.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-error-string.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_error_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-last-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_last_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if a row exists&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-num-rows.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_num_rows&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get the value of the first field of the first row&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-fetch-single.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_fetch_single&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// all done&lt;br /&gt;&lt;br /&gt;// close database file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-close.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_close&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You can even use the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_fetch_single()&lt;/code&gt;&amp;nbsp;function in combination&lt;br /&gt;with a&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;while()&lt;/code&gt;&amp;nbsp;loop to iterate over a result set containing many records&lt;br /&gt;but a single field. Notice also my usage of the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_has_more()&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
function, to check if the next row exists or not.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set path of database file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;DOCUMENT_ROOT&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/../library.db&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open database file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-open.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_open&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Could not open database&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// generate query string&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT DISTINCT author FROM books&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-query.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-error-string.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_error_string&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-last-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_last_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if rows exist&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-num-rows.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_num_rows&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;table cellpadding=10 border=1&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check for more rows&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;while (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-has-more.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_has_more&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get first field from each row&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// print values&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-fetch-single.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_fetch_single&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/table&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// all done&lt;br /&gt;&lt;br /&gt;// close database file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sqlite-close.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sqlite_close&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$handle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You can, of course, do the same thing using object notation in PHP 5. However,&lt;br /&gt;you need to know that&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sqlite_has_more()&lt;/code&gt;&amp;nbsp;is one function that&lt;br /&gt;really doesn’t translate to its object method name; in an OO script, you&lt;br /&gt;would need to call&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result-&amp;gt;valid();&lt;/code&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
This script is the OO equivalent of the one above:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set path of database file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;DOCUMENT_ROOT&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;/../library.db&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create database object&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SQLiteDatabase&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Could not open database&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// generate query string&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT DISTINCT author FROM books&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if rows exist&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;numRows&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;table cellpadding=10 border=1&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check for more rows&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;while (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;valid&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;()) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get first field from each row&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// print values&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fetchSingle&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/table&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// all done&lt;br /&gt;&lt;br /&gt;// destroy database object&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;unset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/7350339948976550807/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-9-sqlite-my-fire-part-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/7350339948976550807'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/7350339948976550807'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-9-sqlite-my-fire-part-1.html' title='PHP 101 (part 9): SQLite My Fire! – Part 1'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s72-c/php_mysql_logo.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-912134281086966504</id><published>2013-11-01T12:58:00.003-07:00</published><updated>2013-11-01T13:02:45.016-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP 101 (part 8): Databases and Other Animals – Part 2"/><title type='text'>PHP 101 (part 8): Databases and Other Animals – Part 2</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s1600/php_mysql_logo.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;185&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s320/php_mysql_logo.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/h2&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Surgical Insertion&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
So now you know how to execute a&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SELECT&lt;/code&gt;&amp;nbsp;query to retrieve a&lt;br /&gt;
result set from the database. However, you can also use PHP’s MySQL API for&lt;br /&gt;
queries that don’t return a result set – for example, an&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;INSERT&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
or&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;UPDATE&lt;/code&gt;&amp;nbsp;query. Consider the following example, which demonstrates&lt;br /&gt;
this by asking for user input through a form and then&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;INSERT&lt;/code&gt;-ing&lt;br /&gt;
that data into the database:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;basefont face=&quot;Arial&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;body&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;submit&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// form not submitted&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;form action=&quot;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?=$_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;PHP_SELF&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&quot; method=&quot;post&quot;&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Country: &amp;lt;input type=&quot;text&quot; name=&quot;country&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;National animal: &amp;lt;input type=&quot;text&quot; name=&quot;animal&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;input type=&quot;submit&quot; name=&quot;submit&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/form&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;br /&gt;&lt;br /&gt;else {&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// form submitted&lt;br /&gt;&lt;br /&gt;// set server access variables&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;localhost&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;testdb&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get form input&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// check to make sure it&#39;s all there&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// escape input values for greater safety&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$country&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= empty(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;country&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) ? die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ERROR: Enter a country&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) :&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_escape_string&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;country&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$animal&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= empty(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;animal&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]) ? die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;ERROR: Enter an animal&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) :&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_escape_string&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;animal&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open connection&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_connect&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to connect!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// select database&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_select_db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to select database!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create query&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;INSERT INTO symbols (country, animal) VALUES (&#39;$country&#39;, &#39;$animal&#39;)&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: $query. &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_error&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;());&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print message with ID of inserted record&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;New record inserted with ID &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_insert_id&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close connection&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_close&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here, the user is first presented with a form asking for a country&lt;br /&gt;
and its national animal.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;img alt=&quot;Surgical Insertion - request form&quot; src=&quot;http://devzone.zend.com/images/articles/vikram8_2.gif&quot; style=&quot;background-color: #f8f8f4; border: 1px solid rgb(230, 230, 230); margin: 0px 0px 10px; outline: 0px; padding: 2px; vertical-align: baseline;&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Once the form is submitted, the form input is used inside to create&lt;br /&gt;
an&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;INSERT&lt;/code&gt;&amp;nbsp;query, which is then sent to the database with&lt;br /&gt;
the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_query()&lt;/code&gt;&amp;nbsp;method. Since&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_query()&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
returns a Boolean value indicating whether the query was successful or&lt;br /&gt;
not, it is possible to check whether the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;INSERT&lt;/code&gt;&amp;nbsp;took place&lt;br /&gt;
and return an appropriate message:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;img alt=&quot;Surgical Insertion - submitted form&quot; src=&quot;http://devzone.zend.com/images/articles/vikram8_3.gif&quot; style=&quot;background-color: #f8f8f4; border: 1px solid rgb(230, 230, 230); margin: 0px 0px 10px; outline: 0px; padding: 2px; vertical-align: baseline;&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
There are two new functions in the example above. The&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_escape_string()&lt;/code&gt;&amp;nbsp;function escapes special characters&lt;br /&gt;
(like quotes) in the user input so that it can be safely entered into the&lt;br /&gt;
database; while the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_insert_id()&lt;/code&gt;&amp;nbsp;returns the ID&lt;br /&gt;
generated by the previous&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;INSERT&lt;/code&gt;&amp;nbsp;query (useful only if the&lt;br /&gt;
table into which the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;INSERT&lt;/code&gt;&amp;nbsp;occurs contains an&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;AUTO_INCREMENT&lt;/code&gt;&amp;nbsp;field). Both these functions are also available&lt;br /&gt;
in&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ext/mysqli&lt;/code&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading8&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Wiping Out&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Obviously, you can also do the same thing with other data manipulation&lt;br /&gt;
statements. This next example demonstrates how to use a&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;DELETE&lt;/code&gt;&lt;br /&gt;
statement with PHP to selectively delete items from the table. For variety,&lt;br /&gt;
I’m going to use&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ext/mysqli&lt;/code&gt;&amp;nbsp;this time around:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;basefont face=&quot;Arial&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set server access variables&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;localhost&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;testdb&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create mysqli object&lt;br /&gt;&lt;br /&gt;// open connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mysqli&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysqli&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check for connection errors&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysqli-connect-errno.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysqli_connect_errno&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;()) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to connect!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if id provided, then delete that record&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_GET&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;id&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create query to delete record&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;DELETE FROM symbols WHERE id = &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_GET&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;id&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;];&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mysqli&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print number of affected rows&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mysqli&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;affected_rows&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; row(s) affected&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print error message&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: $query. &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mysqli&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;error&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// query to get records&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT * FROM symbols&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mysqli&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// see if any rows were returned&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;num_rows&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// yes&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// print them one after another&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;table cellpadding=10 border=1&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fetch_array&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;()) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&amp;lt;a href=&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;PHP_SELF&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;?id=&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;gt;Delete&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// free result set memory&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;close&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print error message&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: $query. &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mysqli&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;error&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mysqli&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;close&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s what it looks like:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;img alt=&quot;Wiping Out&quot; src=&quot;http://devzone.zend.com/images/articles/vikram8_4.gif&quot; style=&quot;background-color: #f8f8f4; border: 1px solid rgb(230, 230, 230); margin: 0px 0px 10px; outline: 0px; padding: 2px; vertical-align: baseline;&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Notice my usage of the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;affected_rows&lt;/code&gt;&amp;nbsp;property of the&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysqli&lt;/code&gt;&amp;nbsp;object here – this returns the total number of rows&lt;br /&gt;
affected by the last operation. It’s available in&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ext/mysql&lt;/code&gt;&lt;br /&gt;
as well, as the function&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_affected_rows()&lt;/code&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading9&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Looking Inside&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
PHP comes with a bunch of functions designed to tell you everything&lt;br /&gt;
you would ever want to know about the MySQL client and server, their&lt;br /&gt;
version numbers, the total number of databases available, the tables&lt;br /&gt;
inside each database, the processes running… you name&lt;br /&gt;
it, and it’s probably there. Here’s an example which uses them to give&lt;br /&gt;
you a big-picture view of what’s going on inside your MySQL RDBMS:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;basefont face=&quot;Arial&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set server access variables&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;localhost&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;root&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;guessme&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;testdb&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_connect&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to connect!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get database list&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SHOW DATABASES&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: $query. &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_error&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;());&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;ul&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;while (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_fetch_array&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;li&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// for each database, get table list and print&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query2&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SHOW TABLES FROM &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;];&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result2&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query2&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: $query2. &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_error&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;());&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;ul&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row2&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_fetch_array&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result2&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;li&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row2&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;];&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/ul&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/ul&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get version and host information&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Client version: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_get_client_info&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Server version: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_get_server_info&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Protocol version: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_get_proto_info&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Host: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_get_host_info&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get server status&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$status&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_stat&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;br /&gt;&lt;br /&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$status&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_close&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s what the output might look like:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;img alt=&quot;Looking Inside&quot; src=&quot;http://devzone.zend.com/images/articles/vikram8_5.gif&quot; style=&quot;background-color: #f8f8f4; border: 1px solid rgb(230, 230, 230); margin: 0px 0px 10px; outline: 0px; padding: 2px; vertical-align: baseline;&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The first part of this script is fairly simple: it runs the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SHOW&lt;br /&gt;DATABASES&lt;/code&gt;&amp;nbsp;query to get a list of databases, then iterates over the&lt;br /&gt;
list and runs the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SHOW TABLES&lt;/code&gt;&amp;nbsp;command to retrieve the list&lt;br /&gt;
of tables inside each. Next, the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_get_*_info()&lt;/code&gt;&amp;nbsp;functions&lt;br /&gt;
provide the client version number, the MySQL version number, the version&lt;br /&gt;
number of the special MySQL client-server protocol used for communication&lt;br /&gt;
between the two, the current host name, and how it is connected to the MySQL&lt;br /&gt;
server. Finally, new in PHP 4.3.0 is the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_stat()&lt;/code&gt;&amp;nbsp;function,&lt;br /&gt;
which returns a string containing status information on the MySQL server&lt;br /&gt;
(including information on server uptime, open tables, queries per second&lt;br /&gt;
and other statistical information).&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading10&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Oops!&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
All done? Nope, not quite yet – before you go out there and start&lt;br /&gt;
building cool data-driven Web sites, you should be aware that both&lt;br /&gt;
MySQL extensions come with powerful error-tracking functions which can&lt;br /&gt;
speed up development time. Take a look at the following example, which&lt;br /&gt;
contains a deliberate error in the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SELECT&lt;/code&gt;&amp;nbsp;query string:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// connect&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_connect&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;localhost&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Invalid server or user&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_select_db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;testdb&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Invalid database&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT FROM symbols&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// look for errors and print&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if(!&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$error_number&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_errno&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$error_msg&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_error&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;MySQL error $error_number: $error_msg&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// disconnect&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_close&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s an example of the output:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;img alt=&quot;Oops!&quot; src=&quot;http://devzone.zend.com/images/articles/vikram8_6.gif&quot; style=&quot;background-color: #f8f8f4; border: 1px solid rgb(230, 230, 230); margin: 0px 0px 10px; outline: 0px; padding: 2px; vertical-align: baseline;&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_errno()&lt;/code&gt;&amp;nbsp;function displays the error code returned&lt;br /&gt;
by MySQL if there’s an error in your SQL statement, while the&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_error()&lt;/code&gt;&amp;nbsp;function returns the actual error message. Turn&lt;br /&gt;
these both on, and you’ll find that they can significantly reduce the time&lt;br /&gt;
you spend fixing bugs.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ext/mysqli&lt;/code&gt;&amp;nbsp;code tree includes two additional functions for&lt;br /&gt;
connection errors,&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysqli_connect_errno()&lt;/code&gt;&amp;nbsp;and&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysqli_connect_error()&lt;/code&gt;, which contain information on connection&lt;br /&gt;
(not query) errors only. Use these to debug errors in your MySQL connections,&lt;br /&gt;
as in the example below:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create mysqli object&lt;br /&gt;&lt;br /&gt;// open connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mysqli&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysqli&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;localhost&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;testdb&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check for connection errors&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysqli-connect-errno.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysqli_connect_errno&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;()) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to connect: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysqli-connect-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysqli_connect_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;());&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT FROM symbols&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mysqli&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// look for errors and print&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if(!&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$error_number&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mysqli&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;errno&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$error_msg&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mysqli&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;error&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;MySQL error $error_number: $error_msg&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// disconnect&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mysqli&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;close&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
And in case you were wondering why I haven’t used object syntax for&lt;br /&gt;
these two functions in the script above, it’s actually very simple: I&lt;br /&gt;
can’t. You see, if there is an error in connecting to the server, the&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysqli()&lt;/code&gt;&amp;nbsp;object will not be created, and so methods and&lt;br /&gt;
properties related to that object will not exist. For this reason, to&lt;br /&gt;
debug connection errors in&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ext/mysqli&lt;/code&gt;, you must always use&lt;br /&gt;
the procedural, rather than the object, notation.&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
And that’s about all I have for this issue of PHP 101. In&lt;br /&gt;
Part Nine&amp;nbsp;I’m going to tell you all&lt;br /&gt;
about PHP 5′s built-in DBMS alternative, the very cool SQLite database&lt;br /&gt;
engine. Don’t miss it!&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/912134281086966504/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-8-databases-and-other_1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/912134281086966504'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/912134281086966504'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-8-databases-and-other_1.html' title='PHP 101 (part 8): Databases and Other Animals – Part 2'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s72-c/php_mysql_logo.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-4004961645525679281</id><published>2013-11-01T12:37:00.000-07:00</published><updated>2013-11-01T13:02:08.301-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP 101 (part 8): Databases and Other Animals – Part 1"/><title type='text'>PHP 101 (part 8): Databases and Other Animals – Part 1</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s1600/php_mysql_logo.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;185&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s320/php_mysql_logo.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/h2&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Mix and Match&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
One of the most compelling things PHP has going for it is its&lt;br /&gt;
support for a variety of database management systems, including MySQL,&lt;br /&gt;
PostgreSQL, Oracle and Microsoft Access. By virtue of this support, PHP&lt;br /&gt;
developers can create sophisticated data-driven Web applications at a&lt;br /&gt;
fraction of the time and cost required by competing alternatives. And&lt;br /&gt;
nowhere is this more clear than in PHP’s longtime support of MySQL, the&lt;br /&gt;
very fast, very reliable and very feature-rich open-source RDBMS.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
By using PHP and MySQL together, developers can benefit from huge&lt;br /&gt;
savings on the licensing costs of commercial alternatives, and also&lt;br /&gt;
leverage off the tremendous amount of thought PHP and MySQL developers&lt;br /&gt;
have put into making sure that the two packages work together&lt;br /&gt;
seamlessly and smoothly. And since both PHP and MySQL are open-source&lt;br /&gt;
projects, when you use the two of them together you know&lt;br /&gt;
you’re getting the most up-to-date technology available. And that’s&lt;br /&gt;
always a good thought to go to bed with.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
OK. Enough of the marketing talk. Let’s get down to business.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In this issue of PHP 101, I’m going to show you how to use PHP to&lt;br /&gt;
extract data from a database, and use that data to dynamically build a&lt;br /&gt;
Web page. In order to try out the examples in this tutorial, you’ll&lt;br /&gt;
need a working MySQL installation, which you can obtain from the MySQL&lt;br /&gt;
Web site at&amp;nbsp;&lt;a href=&quot;http://www.mysql.com/&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://www.mysql.com/&lt;/a&gt;.&lt;br /&gt;
If you have some knowledge of SQL&lt;br /&gt;
(Structured Query Language, the language used to interact with a&lt;br /&gt;
database server) you’ll find it helpful, but it’s not essential.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading2&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Building Blocks&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In order to use MySQL and PHP together, your PHP build must include&lt;br /&gt;
support for MySQL. On UNIX, this is accomplished by adding the&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;--with-mysql&lt;/code&gt;&amp;nbsp;option to the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;configure&lt;/code&gt;&amp;nbsp;script&lt;br /&gt;
when building PHP on UNIX, and pointing PHP to the MySQL client&lt;br /&gt;
libraries. On Windows, the MySQL client libraries are built in to&lt;br /&gt;
PHP 4 and activated by default. In PHP 5, pre-built .dll files&lt;br /&gt;
are included with the Windows distribution. Read more about this at&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.php.net/manual/en/ref.mysql.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://www.php.net/manual/en/ref.mysql.php&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Unix users should note that PHP 4 ships with a set of MySQL&lt;br /&gt;
client libraries, which are activated by default; however, PHP&lt;br /&gt;
5 no longer bundles these libraries due to licensing issues, so you&lt;br /&gt;
need to obtain, install and activate them yourself. They’re included&lt;br /&gt;
with the MySQL distribution, and are installed automatically when you&lt;br /&gt;
install MySQL. To activate the MySQL extension,&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ext/mysql&lt;/code&gt;,&lt;br /&gt;
add the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;--with-mysql&lt;/code&gt;&amp;nbsp;option to PHP’s&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;configure&lt;/code&gt;&lt;br /&gt;
script. For more information on this change, read&lt;br /&gt;
&lt;a href=&quot;http://www.php.net/manual/en/faq.databases.php#faq.databases.mysql.php5&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://www.php.net/manual/en/faq.databases.php#faq.databases.mysql.php5&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
And finally (as if all that wasn’t quite confusing enough) PHP 5 also&lt;br /&gt;
comes with a&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;new&lt;/b&gt;&amp;nbsp;MySQL extension, called&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ext/mysqli&lt;/code&gt;&lt;br /&gt;
(MySQL Improved). You can use this new extension to access the new&lt;br /&gt;
features in MySQL 4.1.2 or better, and to gain the benefits of improved&lt;br /&gt;
speed and security. To activate this extension on UNIX, add the&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;--with-mysqli&lt;/code&gt;&amp;nbsp;option to PHP’s&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;configure&lt;/code&gt;&amp;nbsp;script,&lt;br /&gt;
and point PHP to the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_config&lt;/code&gt;&amp;nbsp;program that comes with&lt;br /&gt;
MySQL 4.1 and above. For Windows users, a pre-built version of&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ext/mysqli&lt;/code&gt;&amp;nbsp;is included in the win32 PHP distribution. Read&lt;br /&gt;
more about this at&amp;nbsp;&lt;a href=&quot;http://www.php.net/manual/en/ref.mysqli.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://www.php.net/manual/en/ref.mysqli.php&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
To figure out which extension you need, use the following rule of thumb:&lt;/div&gt;
&lt;ul style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; list-style: none; margin: 0px 0px 1.5em; outline: 0px; padding: 0px 0px 0px 30px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;If you need the new features in MySQL 4.1.2 or better, or if you’re&lt;br /&gt;using an older version of MySQL but still want to benefit from the&lt;br /&gt;speed/security improvements in the new extension, use&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ext/mysqli&lt;/code&gt;.&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;If you don’t fall into either of the categories above, or don’t know what I’m&lt;br /&gt;talking about, use regular&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ext/mysql&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In case you were wondering, this tutorial covers both&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ext/mysql&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ext/mysqli&lt;/code&gt;, so you actually get two for the price of&lt;br /&gt;
one. Keep reading, and let me introduce you to MySQL.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading3&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Animal Magnetism&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Every MySQL database is composed of one or more&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;tables&lt;/i&gt;. These&lt;br /&gt;
tables, which structure data into rows and columns, are what lend&lt;br /&gt;
organization to the data.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s an example of what a typical table looks like:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;+----+-----------+----------+
| id | country   | animal   |
+----+-----------+----------+
|  1 | America   | eagle    |
|  2 | China     | dragon   |
|  3 | England   | lion     |
|  4 | India     | tiger    |
|  5 | Australia | kangaroo |
|  6 | Norway    | elk      |
+----+-----------+----------+
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
As you can see, a table divides data into rows, with a new entry (or&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;record&lt;/i&gt;) on every row. The data in each row is further broken&lt;br /&gt;
down into cells (or&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fields&lt;/i&gt;), each of which contains a value for&lt;br /&gt;
a particular attribute of the data. For example, if you consider the&lt;br /&gt;
record for the country “India”, you’ll see that the record is clearly&lt;br /&gt;
divided into separate fields for record number, country name and&lt;br /&gt;
national animal.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The rows within a table are not arranged in any particular order -&lt;br /&gt;
they can be sorted alphabetically, by number, by name, or by any&lt;br /&gt;
other criteria you choose to specify. It is therefore necessary to have&lt;br /&gt;
some method of identifying a specific record in a table. In the example&lt;br /&gt;
above, each record is identified by a unique number; this unique field&lt;br /&gt;
is referred to as the&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;primary key&lt;/i&gt;&amp;nbsp;for that table.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You use the Structured Query Language, SQL, to interact with the MySQL&lt;br /&gt;
server and tell it to create a table, mark a field as primary, insert&lt;br /&gt;
records, edit records, retrieve records… basically, anything that&lt;br /&gt;
involves manipulating the data or the database. To see how this works,&lt;br /&gt;
examine the following SQL, which creates the table above:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;CREATE DATABASE testdb;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
CREATE TABLE `symbols` (&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;`id` int(11) NOT NULL auto_increment,&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;`country` varchar(255) NOT NULL default &#39;&#39;,&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;`animal` varchar(255) NOT NULL default &#39;&#39;,&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;PRIMARY KEY&amp;nbsp;&amp;nbsp;(`id`)&lt;br /&gt;
&lt;br /&gt;
) TYPE=MyISAM;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;INSERT INTO `symbols` VALUES (1, &#39;America&#39;, &#39;eagle&#39;);&lt;br /&gt;&lt;br /&gt;INSERT INTO `symbols` VALUES (2, &#39;China&#39;, &#39;dragon&#39;);&lt;br /&gt;&lt;br /&gt;INSERT INTO `symbols` VALUES (3, &#39;England&#39;, &#39;lion&#39;);&lt;br /&gt;&lt;br /&gt;INSERT INTO `symbols` VALUES (4, &#39;India&#39;, &#39;tiger&#39;);&lt;br /&gt;&lt;br /&gt;INSERT INTO `symbols` VALUES (5, &#39;Australia&#39;, &#39;kangaroo&#39;);&lt;br /&gt;&lt;br /&gt;INSERT INTO `symbols` VALUES (6, &#39;Norway&#39;, &#39;elk&#39;);&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You can enter these commands either interactively or&lt;br /&gt;
non-interactively through the MySQL commandline client program,&lt;br /&gt;
which you run by navigating to the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql/bin&lt;/code&gt;&lt;br /&gt;
directory from your shell or DOS box and typing – with no&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/code&gt;&amp;nbsp;because this is a shell command – either&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql&lt;/code&gt;, or&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql db_name&lt;/code&gt;&amp;nbsp;if you want&lt;br /&gt;
to choose an existing database to work with. Read&lt;br /&gt;
&lt;a href=&quot;http://dev.mysql.com/doc/mysql/en/mysql.html&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://dev.mysql.com/doc/mysql/en/mysql.html&lt;/a&gt;&amp;nbsp;for more information&lt;br /&gt;
on how to use the MySQL commandline client, and the tutorial at&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.melonfire.com/community/columns/trog/article.php?id=39&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://www.melonfire.com/community/columns/trog/article.php?id=39&lt;/a&gt;&lt;br /&gt;
to understand what each of the SQL commands above does. SQL is a&lt;br /&gt;
lot like spoken English, so it won’t take you very long to pick it&lt;br /&gt;
up. Just don’t try to turn those backticks into single quotation marks.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Once the data has been imported, run a quick&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SELECT&lt;/code&gt;&lt;br /&gt;
query to check that everything is working as it should be:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql&amp;gt; SELECT * FROM `symbols`;
+----+-----------+----------+
| id | country   | animal   |
+----+-----------+----------+
|  1 | America   | eagle    |
|  2 | China     | dragon   |
|  3 | England   | lion     |
|  4 | India     | tiger    |
|  5 | Australia | kangaroo |
|  6 | Norway    | elk      |
+----+-----------+----------+
6 rows in set (0.06 sec)
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In English, the query above means “show me all the records from the&lt;br /&gt;
table named&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;symbols&lt;/code&gt;“. If you saw the same output as above,&lt;br /&gt;
you’re good to go!&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading4&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Hello Database!&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Now, let’s use PHP to do exactly the same thing. You could use PHP&lt;br /&gt;
to set up the database from the start, but as ours already exists&lt;br /&gt;
we’ll simply fire a&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SELECT&lt;/code&gt;&amp;nbsp;query at the database&lt;br /&gt;
‘testdb’, and display the results in an HTML page:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;basefont face=&quot;Arial&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set database server access variables:&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;localhost&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;testdb&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_connect&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to connect!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// select database&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_select_db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to select database!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT * FROM symbols&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: $query. &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_error&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;());&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// see if any rows were returned&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_num_rows&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// yes&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// print them one after another&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;table cellpadding=10 border=1&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while(&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_fetch_row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/table&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// no&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// print status message&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;No rows found!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// free result set memory&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_free_result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_close&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s what the result looks like:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;img alt=&quot;Hello Database!&quot; src=&quot;http://devzone.zend.com/images/articles/vikram8_1.gif&quot; style=&quot;background-color: #f8f8f4; border: 1px solid rgb(230, 230, 230); margin: 0px 0px 10px; outline: 0px; padding: 2px; vertical-align: baseline;&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
As you can see, using PHP to get data from a database involves&lt;br /&gt;
several steps, each of which is actually a pre-defined PHP function.&lt;br /&gt;
Let’s dissect each step:&lt;/div&gt;
&lt;ol style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; list-style: none; margin: 0px 0px 1.5em; outline: 0px; padding: 0px 0px 0px 30px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;The first thing to do is specify some important information needed&lt;br /&gt;to establish a connection to the database server. This information&lt;br /&gt;includes the server name, the username and password required to gain&lt;br /&gt;access to it, and the name of the database to query. These values are&lt;br /&gt;all set up in regular PHP variables.&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
$host&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;localhost&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;testdb&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;/code&gt;&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;To begin communication with a MySQL database server, you need to&lt;br /&gt;open a connection to that server. All communication between PHP and&lt;br /&gt;the database server takes place through this connection.&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In order to initialize this connection, PHP offers the&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_connect()&lt;/code&gt;&amp;nbsp;function:&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
$connection&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_connect&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$server&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;/code&gt;&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
All the parameters in&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_connect()&lt;/code&gt;are optional, but there&lt;br /&gt;
are three you will generally need to use anywhere beyond your own machine:&lt;br /&gt;
the database server name, username and password. If the database server&lt;br /&gt;
and the Web server are running on the same physical machine, you can use&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;localhost&lt;/code&gt;&amp;nbsp;as the database server name this is in fact the&lt;br /&gt;
default value supplied by PHP.&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_connect()&lt;/code&gt;&amp;nbsp;returns a “link identifier”, which is stored&lt;br /&gt;
in the variable&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&lt;/code&gt;. This identifier is used when&lt;br /&gt;
communicating with the database.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Once you have a connection to the database, you must select&lt;br /&gt;a database for use with the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_select_db()&lt;/code&gt;&amp;nbsp;function:&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
mysql_select_db&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to select database!&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;/code&gt;&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
This function must be passed the name of the database to be used for&lt;br /&gt;
all subsequent queries. An optional second argument here is the link&lt;br /&gt;
identifier; if no identifier is specified, the last opened link is&lt;br /&gt;
assumed. If you have two or more database connections open&lt;br /&gt;
simultaneously, it’s a good idea to specify the link identifier as the&lt;br /&gt;
second argument to&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_select_db()&lt;/code&gt;&amp;nbsp;– and indeed to all other&lt;br /&gt;
mysql_* functions in the script, so that PHP doesn’t get confused about&lt;br /&gt;
which connection to use where.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;The next step is to create the query and execute it. This&lt;br /&gt;is accomplished with the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_query()&lt;/code&gt;&amp;nbsp;function.&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
$query&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT * FROM symbols&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_query&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: $query. &quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_error&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;());&lt;/span&gt;&lt;/div&gt;
&lt;/code&gt;&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
This function also needs two parameters: the query string and the&lt;br /&gt;
link identifier for the connection. Again, if no link identifier is&lt;br /&gt;
specified, the last opened link is used. Depending on whether or not&lt;br /&gt;
the query was successful, the function returns true or false; a failure&lt;br /&gt;
can be caught via the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;...or die()&lt;/code&gt;&amp;nbsp;clause of the statement,&lt;br /&gt;
and the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_error()&lt;/code&gt;&amp;nbsp;function can be used to display the&lt;br /&gt;
corresponding error message.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;If&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_query()&lt;/code&gt;&amp;nbsp;is successful, the result set returned&lt;br /&gt;by the query is stored in the variable&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/code&gt;. This result set may&lt;br /&gt;contain one or more rows or columns of data, depending on your query. You can&lt;br /&gt;retrieve specific subsets of the result set with different PHP functions,&lt;br /&gt;including the one used here – the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_fetch_row()&lt;/code&gt;&amp;nbsp;function -&lt;br /&gt;which fetches a single row of data as an array called&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/code&gt;. Fields&lt;br /&gt;in that row can then be accessed using standard PHP array notation.&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Each time you call&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_fetch_row()&lt;/code&gt;, the next record in the result&lt;br /&gt;
set is returned. This makes&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_fetch_row()&lt;/code&gt;&amp;nbsp;very suitable for&lt;br /&gt;
use in a&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;while()&lt;/code&gt;&amp;nbsp;or&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;for()&lt;/code&gt;&amp;nbsp;loop.&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_num_rows&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_fetch_row&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
}&lt;/div&gt;
&lt;/code&gt;&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Notice that the call to&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_fetch_row()&lt;/code&gt;&amp;nbsp;is wrapped in a&lt;br /&gt;
conditional test, which first checks to see if any rows were returned&lt;br /&gt;
at all. This information is provided by the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_num_rows()&lt;/code&gt;&lt;br /&gt;
function, which contains the number of rows returned by the query. Obviously,&lt;br /&gt;
you can only use this function with queries that return data, like&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SELECT&lt;/code&gt;&amp;nbsp;or&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SHOW&lt;/code&gt;.It is not appropriate for use with&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;INSERT&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;UPDATE&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;DELETE&lt;/code&gt;&amp;nbsp;or similar queries.&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
There are several other alternatives to&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_fetch_row()&lt;/code&gt;,&lt;br /&gt;
which will be explained a little later.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: decimal; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Finally, since each result set returned after a query&lt;br /&gt;occupies memory, it’s a good idea to use the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_free_result()&lt;/code&gt;&lt;br /&gt;function to free up the used memory. After the result set is freed, if no&lt;br /&gt;further queries are to be run, you can close the connection to the MySQL&lt;br /&gt;server with&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_close()&lt;/code&gt;.&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;div style=&quot;background-color: transparent; border: 0px; font-family: sans-serif; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
mysql_free_result&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_close&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;/code&gt;&lt;div style=&quot;background-color: transparent; border: 0px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading5&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Different Strokes…&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You can also use PHP’s&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_fetch_row()&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;list()&lt;/code&gt;&lt;br /&gt;
functions to obtain a simple array of values, and then assign these values to&lt;br /&gt;
different variables – a variation of the technique in the previous section.&lt;br /&gt;
Take a look (only the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;while()&lt;/code&gt;&amp;nbsp;loop changes):&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;basefont face=&quot;Arial&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set server access variables&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;localhost&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;testdb&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_connect&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to connect!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// select database&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_select_db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to select database!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT * FROM symbols&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: $query. &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_error&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;());&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// see if any rows were returned&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_num_rows&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// yes&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// print them one after another&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;table cellpadding=10 border=1&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while(list(&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$id&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$country&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$animal&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)&amp;nbsp;&amp;nbsp;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_fetch_row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;$id&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;$country&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;$animal&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/table&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// no&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// print status message&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;No rows found!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// free result set memory&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_free_result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_close&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In this case, the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;list()&lt;/code&gt;&amp;nbsp;function is used to assign different&lt;br /&gt;
elements of the result set to PHP variables, which are then used when&lt;br /&gt;
rendering the page.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You can use PHP’s&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_fetch_assoc()&lt;/code&gt;&amp;nbsp;function to represent each&lt;br /&gt;
row as an associative array of field-value pairs – a minor variation of the&lt;br /&gt;
technique used above:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;basefont face=&quot;Arial&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set server access variables&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;localhost&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;testdb&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_connect&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to connect!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// select database&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_select_db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to select database!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT * FROM symbols&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: $query. &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_error&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;());&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// see if any rows were returned&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_num_rows&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// yes&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// print them one after another&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;table cellpadding=10 border=1&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while(&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_fetch_assoc&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;id&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;country&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;animal&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/table&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// no&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// print status message&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;No rows found!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// free result set memory&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_free_result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_close&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Notice that in this case, field values are accessed using the field&lt;br /&gt;
name instead of the index.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Of all the alternatives, however, the function I like the most is&lt;br /&gt;
the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_fetch_object()&lt;/code&gt;&amp;nbsp;function, which returns each&lt;br /&gt;
row as an object (remember them from&amp;nbsp;&lt;a href=&quot;http://devzone.zend.com/12/php-101-part-8-databases-and-other-animals_part-1/php101-7.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;Part Seven&lt;/a&gt;?) with properties&lt;br /&gt;
corresponding to the field names:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;basefont face=&quot;Arial&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set server access variables&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;localhost&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;testdb&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_connect&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to connect!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// select database&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_select_db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to select database!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT * FROM symbols&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: $query. &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_error&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;());&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// see if any rows were returned&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_num_rows&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// yes&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// print them one after another&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;table cellpadding=10 border=1&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while(&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_fetch_object&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;country&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;animal&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/table&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// no&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// print status message&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;No rows found!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// free result set memory&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_free_result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_close&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here, each&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/code&gt;&amp;nbsp;object is created with properties&lt;br /&gt;
corresponding to the field names in that row. Row values can&lt;br /&gt;
thus be accessed using standard&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;object-&amp;gt;property&lt;/code&gt;&lt;br /&gt;
notation.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If you’re the type that likes to have your cake and eat it too, you&lt;br /&gt;
will probably enjoy the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_fetch_array()&lt;/code&gt;&amp;nbsp;function, which&lt;br /&gt;
returns both an associative array and a numerically-indexed array, a&lt;br /&gt;
combination of the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_fetch_row()&lt;/code&gt;&amp;nbsp;and&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysql_fetch_assoc()&lt;/code&gt;&amp;nbsp;functions. Read about it at&lt;br /&gt;
&lt;a href=&quot;http://www.php.net/manual/en/function.mysql-fetch-array.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;http://www.php.net/manual/en/function.mysql-fetch-array.php&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading6&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
…for Different Folks&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If you’re using PHP 5, you can do the same thing using the new&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ext/mysqli&lt;/code&gt;&amp;nbsp;extension, which offers a number of new features. This&lt;br /&gt;
extension can be used in two ways: procedural (using functions), and&lt;br /&gt;
object-oriented (using class methods and properties). Consider the next&lt;br /&gt;
script, which uses&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ext/mysqli&lt;/code&gt;&amp;nbsp;in a procedural manner:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;basefont face=&quot;Arial&quot;&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;body&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set server access variables&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;localhost&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;testdb&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysqli-connect.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysqli_connect&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to connect!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT * FROM symbols&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysqli-query.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysqli_query&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: $query. &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysqli-error.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysqli_error&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;());&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// see if any rows were returned&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysqli-num-rows.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysqli_num_rows&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) &amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// yes&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// print them one after another&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;table cellpadding=10 border=1&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while(&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysqli-fetch-row.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysqli_fetch_row&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/table&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// no&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// print status message&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;No rows found!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// free result set memory&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysqli-free-result.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysqli_free_result&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mysqli-close.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mysqli_close&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
As you can see, this looks a lot like the code written for&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ext/mysql&lt;/code&gt;. The only real difference – at least to the naked eye&lt;br /&gt;
- is the fact that function names now begin with mysqli_* instead of mysql_*.&lt;br /&gt;
Of course, there are a whole bunch of differences under the hood:&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ext/mysqli&lt;/code&gt;&amp;nbsp;is faster, more secure and more powerful than regular&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ext/mysql&lt;/code&gt;, and also includes support for prepared statements,&lt;br /&gt;
bound result sets, multiple simultaneous queries, transactions and a whole&lt;br /&gt;
bunch of other cool stuff.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You can also use&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ext/mysqli&lt;/code&gt;&amp;nbsp;in an object-oriented way,&lt;br /&gt;
where each task – connecting, querying, fetching – is actually a method&lt;br /&gt;
of the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysqli()&lt;/code&gt;&amp;nbsp;object:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;basefont face=&quot;Arial&quot;&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set server access variables&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;localhost&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;testdb&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create mysqli object&lt;br /&gt;&lt;br /&gt;// open connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mysqli&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysqli&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$host&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$user&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$pass&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$db&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check for connection errors&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysqli_connect_errno&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;()) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Unable to connect!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;SELECT * FROM symbols&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// execute query&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mysqli&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// see if any rows were returned&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;num_rows&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// yes&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// print them one after another&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;table cellpadding=10 border=1&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;while(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fetch_array&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;()) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/td&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/tr&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;/table&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// no&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// print status message&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;No rows found!&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// free result set memory&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;close&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;br /&gt;
&lt;br /&gt;
else {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print error message&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Error in query: $query. &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mysqli&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;error&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close connection&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mysqli&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;close&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here, the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;new&lt;/code&gt;&amp;nbsp;keyword is used to instantiate an object of class&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysqli&lt;/code&gt;, and pass the object constructor connection information&lt;br /&gt;
(including the database name). The resulting object, stored in the variable&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mysqli&lt;/code&gt;, then exposes methods and properties to perform the&lt;br /&gt;
tasks of querying, fetching and processing rows, and handling errors.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If you look closely at the two scripts above, you’ll notice the numerous&lt;br /&gt;
similarities between the function and method names, and the structure of&lt;br /&gt;
the script. Of the two, though, the object-oriented method is recommended,&lt;br /&gt;
especially in light of the new object model in PHP 5.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
A couple of other important differences to keep in mind:&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;ul style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; list-style: none; margin: 0px 0px 1.5em; outline: 0px; padding: 0px 0px 0px 30px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;With&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;ext/mysqli&lt;/code&gt;, you can include the database name in the&lt;br /&gt;arguments passed to the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysqli_connect()&lt;/code&gt;&amp;nbsp;function or to the&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysqli()&lt;/code&gt;constructor.&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;When calling&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysqli_query()&lt;/code&gt;&amp;nbsp;or the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;mysqli&lt;/code&gt;&lt;br /&gt;object’s&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;query()&lt;/code&gt;&amp;nbsp;method, the link identifier is mandatory,&lt;br /&gt;not optional.&lt;/li&gt;
&lt;/ul&gt;
&lt;div&gt;
&lt;a href=&quot;http://tcbonlinenow.blogspot.dk/2013/11/php-101-part-8-databases-and-other_1.html&quot; style=&quot;background-color: white; border: 0px; color: #4081af; font-family: sans-serif; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;PHP 101 (part 8): Databases and Other Animals – Part 2&lt;/a&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/4004961645525679281/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-8-databases-and-other.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/4004961645525679281'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/4004961645525679281'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-8-databases-and-other.html' title='PHP 101 (part 8): Databases and Other Animals – Part 1'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s72-c/php_mysql_logo.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-4945853125142608798</id><published>2013-11-01T12:25:00.001-07:00</published><updated>2013-11-01T12:25:13.914-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP 101 (part 7): The Bear Necessities – Part 2"/><title type='text'>PHP 101 (part 7): The Bear Necessities – Part 2</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s1600/php_mysql_logo.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;185&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s320/php_mysql_logo.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/h2&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Ending On A High Note&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Just as there are constructors, so also are there&lt;br /&gt;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;destructors&lt;/b&gt;. Destructors are object methods which are called&lt;br /&gt;when the last reference to an object in memory is destroyed, and they&lt;br /&gt;are usually tasked with clean-up work – for example, closing database&lt;br /&gt;connections or files, destroying a session and so on. Destructors are&lt;br /&gt;only available in PHP 5, and must be named&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;__destruct()&lt;/code&gt;.&lt;br /&gt;Here’s an example:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 5&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// class definition&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define properties&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$weight&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$age&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$sex&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$colour&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// constructor&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;__construct&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;age&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;colour&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;brown&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// destructor&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;__destruct&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is dead. He was &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;age&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; years old and &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; units heavy. Rest in peace!&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define methods&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eat&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$units&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is eating &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$units&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; units of food...&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;+=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$units&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public function&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;run&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is running...&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public function&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;kill&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is killing prey...&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create instance of Bear()&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$daddy&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$daddy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Daddy Bear&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$daddy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;age&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$daddy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;kill&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$daddy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eat&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2000&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$daddy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;run&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$daddy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eat&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here, once the script ends, no reference will exist for&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$daddy&lt;/code&gt;, and&lt;br /&gt;so the destructor will be called automatically. The output would look like this:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Daddy Bear is killing prey...
Daddy Bear is eating 2000 units of food...
Daddy Bear is running...
Daddy Bear is eating 100 units of food...
Daddy Bear is dead. He was 10 years old and 2200 units heavy. Rest in peace!
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading10&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Discovering New Things&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
PHP 4 and PHP 5 come with a bunch of functions designed to let you&lt;br /&gt;discover object properties and methods, and find out which class an&lt;br /&gt;object belongs to. The first two of these are the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;get_class()&lt;/code&gt;&lt;br /&gt;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;get_parent_class()&lt;/code&gt;&amp;nbsp;functions, which tell you the name of&lt;br /&gt;the classes which spawned a particular object. Consider the following&lt;br /&gt;class definition:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 5&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// base class&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$weight&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// constructor&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;__construct&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define methods&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eat&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public function&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;run&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public function&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sleep&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// derived class&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;GrizzlyBear&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;extends&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;kill&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
And now consider the following script, which uses&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;get_class()&lt;/code&gt;&amp;nbsp;and&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;get_parent_class()&lt;/code&gt;&amp;nbsp;to retrieve the class name from an instance:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
$joe&amp;nbsp;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;GrizzlyBear&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$joe&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Joe Bear&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$joe&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Class: &quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.get-class.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;get_class&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$joe&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Parent class: &quot;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.get-parent-class.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;get_parent_class&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.get-class.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;get_class&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$joe&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You can view all the properties exposed by a class with&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;get_class_vars()&lt;/code&gt;, and all its methods with&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;get_class_methods()&lt;/code&gt;&lt;br /&gt;function. To view properties of the specific object instance, use&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;get_object_vars()&lt;/code&gt;&amp;nbsp;instead of&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;get_class_vars()&lt;/code&gt;.&lt;br /&gt;Here is an example:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create instance&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$joe&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;GrizzlyBear&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$joe&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Joe Bear&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$joe&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get class name&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$className&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.get-class.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;get_class&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$joe&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get class properties&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Class properties:&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.print-r.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;print_r&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.get-class-vars.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;get_class_vars&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$className&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get class methods&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&lt;br /&gt;Class methods:&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.print-r.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;print_r&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.get-class-methods.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;get_class_methods&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$className&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get this instance&#39;s properties&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&lt;br /&gt;Instance properties:&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.print-r.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;print_r&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.get-object-vars.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;get_object_vars&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$joe&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
and here is some sample output:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Class properties:
Array
(
    [name] =&amp;gt; 
    [weight] =&amp;gt; 
)

Class methods:
Array
(
    [0] =&amp;gt; kill
    [1] =&amp;gt; __construct
    [2] =&amp;gt; eat
    [3] =&amp;gt; run
    [4] =&amp;gt; sleep
)

Instance properties:
Array
(
    [name] =&amp;gt; Joe Bear
    [weight] =&amp;gt; 1000
)
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
As noted in one of the previous segments of this tutorial, the&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;print_r()&lt;/code&gt;&amp;nbsp;function allows you to look inside any PHP variable,&lt;br /&gt;including an object. It’s extremely useful, so note it down for future&lt;br /&gt;reference.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading11&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Access Denied&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
And now that you know the basics of how objects work in PHP, let’s wrap this up with a real-world example. Consider the following userAuth() class, which exposes methods to validate a user login using an encrypted password file such as /etc/passwd or .htaccess, both of which are used on Unix systems (i.e. most of the Internet). I’ll assume here that the passwords in the password file are encrypted with MD5, and use a 12-character salt beginning with $1$:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 5&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// class definition&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;userAuth&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define properties&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$username&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$passwd&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$passwdFile&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_resultCode&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// constructor&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// must be passed username and password&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;__construct&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$username&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$password&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;username&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$username&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;passwd&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$password&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;_resultCode&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= -&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// used to set file to read for password data&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;setPasswdFile&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;passwdFile&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// returns: -1 if user does not exist&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0 if user exists but password is incorrect&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1 if username and password are correct&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getResultCode&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;_resultCode&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public function&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;authenticateUser&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// make sure that the script has permission to read this file!&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.file.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;file&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;passwdFile&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// iterate through file&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;foreach (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$line&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$arr&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.explode.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;explode&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;:&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$line&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if username matches&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// test password&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$arr&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] ==&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;username&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if match, user/pass combination is correct&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// return 1&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$arr&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] ==&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.crypt.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;crypt&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;passwd&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$arr[1]&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;_resultCode&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// otherwise return 0&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;_resultCode&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// end class definition&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Most of this should be clear to you from the examples in previous&lt;br /&gt;pages. In case it isn’t, the following script should help you&lt;br /&gt;understand what’s happening:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create instance&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$ua&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;userAuth&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;joe&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;secret&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set password file&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$ua&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;setPasswdFile&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;passwd.txt&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// perform authentication&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$ua&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;authenticateUser&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check result code and display message&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;switch (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$ua&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getResultCode&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;()) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case -&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Could not find your user account&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Your password was incorrect&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Welcome, &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$ua&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;username&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;br /&gt;&lt;br /&gt;}&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here, the username and password is passed to the object constructor,&lt;br /&gt;as is the name and path of the file containing authentication&lt;br /&gt;credentials. The&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;authenticateUser()&lt;/code&gt;&amp;nbsp;method takes care of parsing the&lt;br /&gt;password file and checking if the user exists and the password is&lt;br /&gt;correct. Depending on what it finds, a result code is generated and&lt;br /&gt;stored in the private variable&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_resultCode&lt;/code&gt;. This variable&lt;br /&gt;can be read through the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getResultCode()&lt;/code&gt;&amp;nbsp;method, and an appropriate message&lt;br /&gt;displayed. And since this entire thing is neatly encapsulated in a&lt;br /&gt;class, I can take it anywhere, use it in any script – even inside&lt;br /&gt;another application – and extend it to support different types of&lt;br /&gt;authentication schemes and containers.&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
There’s a lot more you can do with objects, especially in PHP 5;&lt;br /&gt;I’ve restrained myself here because I didn’t want to confuse you too&lt;br /&gt;much with talk of overloading, abstract classes and static methods. If&lt;br /&gt;you’re interested, however, drop by&lt;br /&gt;&lt;a href=&quot;http://www.php.net/manual/en/language.oop.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;http://www.php.net/manual/en/language.oop.php&lt;/a&gt;&lt;br /&gt;for more.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/4945853125142608798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-7-bear-necessities-part-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/4945853125142608798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/4945853125142608798'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-7-bear-necessities-part-2.html' title='PHP 101 (part 7): The Bear Necessities – Part 2'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s72-c/php_mysql_logo.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-5266025243514246596</id><published>2013-11-01T12:23:00.000-07:00</published><updated>2013-11-01T12:26:21.653-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP 101 (part 7): The Bear Necessities"/><title type='text'>PHP 101 (part 7): The Bear Necessities</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s1600/php_mysql_logo.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;185&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s320/php_mysql_logo.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/h2&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Alphabet Soup&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
So now you know how to create your own functions in PHP, and&lt;br /&gt;
you’ve spent the last few days busily inspecting your applications and&lt;br /&gt;
turning repeated code fragments into functions. But functions are just&lt;br /&gt;
the tip of the software abstraction iceberg. Lurking underneath is a&lt;br /&gt;
three-letter acronym that strikes fear into the hearts of most newbie&lt;br /&gt;
programmers.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
OOP.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If you’ve been programming for a while, you’ve probably heard the&lt;br /&gt;
term OOP before – it stands for Object Oriented Programming, and refers&lt;br /&gt;
to a technique whereby you create program “objects”&lt;br /&gt;
and then use these objects to build the functionality you need into&lt;br /&gt;
your program. PHP 5 is very big on OOP – it comes with a&lt;br /&gt;
brand-spanking-new object model which finally brings PHP objects into&lt;br /&gt;
conformance with standard OOP principles and offers OO programmers a&lt;br /&gt;
whole bunch of new goodies to play with.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Wondering how you can get in on this? Well, wonder no more. Your&lt;br /&gt;
prayers have been answered.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Over the course of this tutorial, I’m going to take a&lt;br /&gt;
brief look at PHP’s OO capabilities (both PHP 4 and PHP 5), together&lt;br /&gt;
with examples and explanations to demonstrate just how powerful it&lt;br /&gt;
really is. I’ll be covering most of the basics – classes, objects,&lt;br /&gt;
attributes and methods – and a couple of more advanced concepts -&lt;br /&gt;
constructors, destructors, private methods and properties, and&lt;br /&gt;
inheritance. And if you’re new to object-oriented programming, or just&lt;br /&gt;
apprehensive about what lies ahead, don’t worry – I promise this will&lt;br /&gt;
be a lot less painful than you think. And unlike dentists, I don’t lie.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading2&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Back To Class&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Before beginning, though, let’s make sure that you have a clear idea&lt;br /&gt;
of the concepts involved here.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In PHP, a&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class&lt;/b&gt;&amp;nbsp;is simply a set of program statements which&lt;br /&gt;
perform a specific task. A typical class definition contains both&lt;br /&gt;
variables and functions, and serves as the template from which to spawn&lt;br /&gt;
specific instances of that class.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
These specific instances of a class are referred to as&lt;br /&gt;
&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;objects&lt;/b&gt;. Every object has certain characteristics, or&lt;br /&gt;
&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;properties&lt;/b&gt;, and certain pre-defined functions, or&lt;br /&gt;
&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;methods&lt;/b&gt;. These properties and methods of the object correspond&lt;br /&gt;
directly with the variables and functions within the class&lt;br /&gt;
definition.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Once a class has been defined, PHP allows you to spawn as many&lt;br /&gt;
instances of the class as you like. Each of these instances is a&lt;br /&gt;
completely independent object, with its own properties and methods, and&lt;br /&gt;
can therefore be manipulated independently of other objects. This comes in&lt;br /&gt;
handy in situations where you need to spawn more than one instance of&lt;br /&gt;
an object – for example, two simultaneous database links for two&lt;br /&gt;
simultaneous queries, or two shopping carts.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Classes also help you keep your code modular – you can define a&lt;br /&gt;
class in a separate file, and include that file only in the scripts&lt;br /&gt;
where you plan to use the class – and simplify code changes, since you&lt;br /&gt;
only need to edit a single file to add new functionality to all your&lt;br /&gt;
spawned objects.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading3&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Animal Antics&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
To understand this better, pick an animal, any animal. I pick the&lt;br /&gt;
bear, because I like bears. Now ask yourself, can you consider this&lt;br /&gt;
bear, within the framework of OOP, as an “object”?&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Why not? After all, every bear has certain characteristics – age,&lt;br /&gt;
weight, sex – which are equivalent to object properties. And every bear&lt;br /&gt;
can perform certain activities – eat, sleep, walk, run, mate – all of&lt;br /&gt;
which are equivalent to object methods.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Let’s take it a little further. Since all bears share certain&lt;br /&gt;
characteristics, it is possible to conceive of a template&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear()&lt;/code&gt;, which&lt;br /&gt;
defines the basic characteristics and abilities of every bear on the&lt;br /&gt;
planet. Once this&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear()&lt;/code&gt;&amp;nbsp;(“class”) is used to create a new&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$bear&lt;/code&gt;&amp;nbsp;(“object”), the individual characteristics of the newly-created&lt;br /&gt;
Bear can be manipulated independently of other Bears that may be created&lt;br /&gt;
from the template.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Now, if you sat down to code this class in PHP 5,&lt;br /&gt;
it would probably look something like this:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 5&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// class definition&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define properties&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$weight&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$age&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$sex&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$colour&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define methods&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eat&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is eating...&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;run&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is running...&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public function&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;kill&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is killing prey...&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public function&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sleep&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is sleeping...&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Given this class, it’s now simple to spawn as many Bears as you&lt;br /&gt;
like, and adjust the individual properties of each. Take a look:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// my first bear&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$daddy&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// give him a name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$daddy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Daddy Bear&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// how old is he&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$daddy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;age&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// what sex is he&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$daddy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sex&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;male&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// what colour is his coat&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$daddy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;colour&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;black&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// how much does he weigh&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$daddy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;300&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// give daddy a wife&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mommy&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mommy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Mommy Bear&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mommy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;age&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mommy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sex&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;female&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mommy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;colour&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;black&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mommy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;310&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// and a baby to complete the family&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Baby Bear&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;age&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sex&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;male&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;colour&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;black&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;180&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// a nice evening in the Bear family&lt;br /&gt;&lt;br /&gt;// daddy kills prey and brings it home&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$daddy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;kill&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// mommy eats it&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mommy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eat&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// and so does baby&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eat&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// mommy sleeps&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$mommy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sleep&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// and so does daddy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$daddy&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sleep&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// baby eats some more&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eat&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
As the illustration above shows, once new objects are defined, their&lt;br /&gt;
individual methods and variables can be accessed and modified&lt;br /&gt;
independent of each other. This comes in very handy, as the rest of this&lt;br /&gt;
tutorial will show.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading4&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Going Deeper&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Now that you’ve got the concepts straight, let’s take a look at the&lt;br /&gt;
nitty-gritty of a class definition.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 5&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// class definition&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define public properties&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$age&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// more properties&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// define public methods&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eat&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is eating...&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// more code&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// more methods&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Every class definition begins with the keyword class, followed by a&lt;br /&gt;
class name. You can give your class any name that strikes your fancy,&lt;br /&gt;
so long as it doesn’t collide with a reserved PHP word. A pair of curly&lt;br /&gt;
braces encloses all class variables and functions, which are written as&lt;br /&gt;
you would normally code them.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
PHP&lt;br /&gt;
5 also introduces the concept of visibility to the object model.&lt;br /&gt;
Visibility controls the extent to which object properties and methods&lt;br /&gt;
can be manipulated by the caller, and plays an important role in&lt;br /&gt;
defining how open or closed your class is. Three levels of visibility&lt;br /&gt;
exist, ranging from most visible to least visible:&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public&lt;/b&gt;,&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;private&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
and&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;protected&lt;/b&gt;. Within the class definition, you can&lt;br /&gt;
mark the visibility of a property or method by preceding&lt;br /&gt;
it with one of the keywords –&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public&lt;/code&gt;,&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;private&lt;/code&gt;, or&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;protected&lt;/code&gt;&amp;nbsp;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
By default, class methods and properties are&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public&lt;/code&gt;; this allows the&lt;br /&gt;
calling script to reach inside your object instances and manipulate&lt;br /&gt;
them directly. If you don’t like the thought of this intrusion, you can&lt;br /&gt;
mark a particular property or method as&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;private&lt;/code&gt;&amp;nbsp;or&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;protected&lt;/code&gt;,&lt;br /&gt;
depending on how much control you want to cede over the object’s internals (more&lt;br /&gt;
on this shortly).&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Since the PHP 4 object model does not include&lt;br /&gt;
support for visibility, the class definition above would not work in&lt;br /&gt;
PHP 4. Instead, you would need to use the following:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// class definition&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define properties&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;var&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$weight&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$age&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$sex&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$colour&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define methods&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eat&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is eating...&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;run&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is running...&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;kill&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is killing prey...&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sleep&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is sleeping...&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
From the above, it should be clear that class properties and methods in PHP&lt;br /&gt;
4 are always public …and there ain’t nuttin’ you can do about that!&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In order to create a&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;new&lt;/b&gt;&amp;nbsp;instance of a class, you use the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;new&lt;/code&gt;&lt;br /&gt;
keyword to assign the newly created object to a PHP variable.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
$daddy&amp;nbsp;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In English, the above would mean “create a new object of class&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear()&lt;/code&gt;&amp;nbsp;and assign it to the variable&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$daddy&lt;/code&gt;&amp;nbsp;“.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You can now access all the methods and properties of the class via&lt;br /&gt;
this variable. For example, the code&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
$daddy&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Daddy Bear&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
would mean “assign the value&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Daddy Bear&lt;/code&gt;&amp;nbsp;to the variable&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$name&lt;/code&gt;&amp;nbsp;of&lt;br /&gt;
this specific instance of the class&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear()&lt;/code&gt;“, while the statement&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
$daddy&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sleep&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
would mean “execute the function&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sleep()&lt;/code&gt;&amp;nbsp;for this specific instance&lt;br /&gt;
of the class&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear()&lt;/code&gt;“.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Note the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/code&gt;&amp;nbsp;symbol used to connect objects to their properties or&lt;br /&gt;
methods, and the fact that the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$&lt;/code&gt;&amp;nbsp;symbol is omitted when accessing&lt;br /&gt;
properties of a class instance.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading5&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
This And That&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In case you need to access functions or variables within the class&lt;br /&gt;
definition itself, both PHP 4 and PHP 5 offer the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/code&gt;&lt;br /&gt;
keyword, which is used to refer to “this” class. To see how this works,&lt;br /&gt;
let’s alter the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eat()&lt;/code&gt;&amp;nbsp;method to accept a number of food units and then&lt;br /&gt;
add that to the bear’s weight.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 5&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// class definition&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define properties&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$weight&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define methods&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eat&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$units&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is eating &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$units&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; units of food...&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;+=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$units&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
}&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In this case, the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/code&gt;&amp;nbsp;prefix indicates that the variable to be&lt;br /&gt;
modified exists within the class – or, in English, “add the argument&lt;br /&gt;
provided to&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eat()&lt;/code&gt;&amp;nbsp;to the variable&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$weight&lt;/code&gt;&amp;nbsp;within this object”. The&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/code&gt;&amp;nbsp;prefix thus provides a convenient way to access variables and&lt;br /&gt;
functions which are “local” to the class.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s an example of how it works:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create instance&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Baby Bear&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// now create another instance&lt;br /&gt;&lt;br /&gt;// this one has independent values for each property&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$brother&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$brother&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Brother Bear&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$brother&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// retrieve properties&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; weighs &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; units&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$brother&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; weighs &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$brother&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; units&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// call eat()&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eat&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eat&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;50&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$brother&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eat&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;11&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// retrieve new values&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; now weighs &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; units&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$brother&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; now weighs &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$brother&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; units&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The output of this will read:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Baby Bear weighs 1000 units
Brother Bear weighs 1000 units
Baby Bear is eating 100 units of food...
Baby Bear is eating 50 units of food...
Brother Bear is eating 11 units of food...
Baby Bear now weighs 1150 units
Brother Bear now weighs 1011 units
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading6&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Under Construction&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
It’s also possible to automatically execute a function when the&lt;br /&gt;
class is called to create a new object. This is referred to in geek&lt;br /&gt;
lingo as a&amp;nbsp;&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;constructor&lt;/b&gt;&amp;nbsp;and, in order to use it, your PHP 5&lt;br /&gt;
class definition must contain a special function,&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;__construct()&lt;/code&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
For example, if you’d like all newly born bears to be brown and weigh&lt;br /&gt;
100 units, you could add this to your class definition:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 5&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// class definition&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define properties&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$weight&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$age&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$colour&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// constructor&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;__construct&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;age&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;colour&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;brown&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define methods&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In PHP 4, your constructor must have the same name as the class.&lt;br /&gt;
Here’s the equivalent code for PHP 4:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// class definition&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define properties&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;var&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$weight&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$age&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$colour&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// constructor&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;age&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;colour&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;brown&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define methods&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Now, try creating and using an instance of the class:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create instance&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Baby Bear&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;colour&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; and weighs &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$baby&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; units at birth&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here, the constructor automatically sets default properties every&lt;br /&gt;
time an object of the class is instantiated. Therefore, when you run&lt;br /&gt;
the script above, you will see this:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Baby Bear is brown and weighs 100 units at birth
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading7&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Hands Off&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
As noted previously, PHP 5 makes it possible to mark class&lt;br /&gt;
properties and methods as&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;private&lt;/code&gt;, which means that they cannot be&lt;br /&gt;
manipulated or viewed outside the class definition. This is useful to&lt;br /&gt;
protect the inner workings of your class from manipulation by object&lt;br /&gt;
instances. Consider the following example, which illustrates this by adding&lt;br /&gt;
a new&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;private&lt;/code&gt;&amp;nbsp;variable,&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_lastUnitsConsumed&lt;/code&gt;,&lt;br /&gt;
to the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear()&lt;/code&gt;&amp;nbsp;class:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 5&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// class definition&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define properties&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$age&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$weight&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;private&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_lastUnitsConsumed&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// constructor&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;__construct&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;age&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;_lastUnitsConsumed&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define methods&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eat&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$units&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is eating &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$units&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; units of food...&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;+=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$units&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;_lastUnitsConsumed&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$units&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public function&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getLastMeal&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Units consumed in last meal were &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;_lastUnitsConsumed&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
}&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Now, since the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_lastUnitsConsumed&lt;/code&gt;&amp;nbsp;variable is declared as&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;private&lt;/code&gt;,&lt;br /&gt;
any attempt to modify it from an object instance will fail. Here is an&lt;br /&gt;
example:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
$bob&amp;nbsp;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$bob&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Bobby Bear&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$bob&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eat&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$bob&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eat&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;200&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$bob&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getLastMeal&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// the next line will generate a fatal error&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$bob&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;_lastUnitsConsumed&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In a similar way, class methods can also be marked as&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;private&lt;/code&gt;&amp;nbsp;- try&lt;br /&gt;
it out for yourself and see.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading8&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Extending Yourself&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Two of the best things about OOP, whether in PHP 4 or in PHP 5, are&lt;br /&gt;
extensibility and inheritance. Very simply, this means that you can&lt;br /&gt;
create a new class based on an existing class, add new features (read:&lt;br /&gt;
properties and methods) to it, and then create objects based on this&lt;br /&gt;
new class. These objects will contain all the features of the original&lt;br /&gt;
parent class, together with the new features of the child class.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
As an illustration, consider the following&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;PolarBear()&lt;/code&gt;&amp;nbsp;class, which&lt;br /&gt;
&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;extends&lt;/b&gt;&amp;nbsp;the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear()&lt;/code&gt;&amp;nbsp;class with a new method.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 5&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// class definition&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define properties&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$weight&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$age&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$sex&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$colour&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// constructor&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;__construct&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;age&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define methods&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;eat&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$units&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is eating &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$units&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; units of food...&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;+=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$units&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public function&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;run&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is running...&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public function&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;kill&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is killing prey...&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public function&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;sleep&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is sleeping...&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// extended class definition&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;PolarBear&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;extends&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// constructor&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;__construct&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;parent&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;__construct&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;colour&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;white&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;600&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define methods&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;public function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;swim&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is swimming...&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;extends&lt;/code&gt;&amp;nbsp;keyword is used to extend a parent class to a child&lt;br /&gt;
class. All the functions and variables of the parent class immediately&lt;br /&gt;
become available to the child class. This is clearly visible in the&lt;br /&gt;
following code snippet:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create instance of Bear()&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$tom&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$tom&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Tommy Bear&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create instance of PolarBear()&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$bob&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;PolarBear&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$bob&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Bobby Bear&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// $bob can use all the methods of Bear() and PolarBear()&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$bob&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;run&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$bob&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;kill&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$bob&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;swim&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// $tom can use all the methods of Bear() but not PolarBear()&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$tom&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;run&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$tom&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;kill&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$tom&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;swim&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In this case, the final call to&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$tom-&amp;gt;swim()&lt;/code&gt;&amp;nbsp;will fail and cause&lt;br /&gt;
an error, because the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear()&lt;/code&gt;&amp;nbsp;class does not contain a&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;swim()&lt;/code&gt;&amp;nbsp;method.&lt;br /&gt;
However, none of the calls to&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$bob-&amp;gt;run()&lt;/code&gt;&amp;nbsp;or&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$bob-&amp;gt;kill()&lt;/code&gt;&amp;nbsp;will&lt;br /&gt;
fail, because as a child of the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear()&lt;/code&gt;&amp;nbsp;class,&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;PolarBear()&lt;/code&gt;&amp;nbsp;inherits all&lt;br /&gt;
the methods and properties of its parent.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Note how the parent class constructor has been called in the&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;PolarBear()&lt;/code&gt;&amp;nbsp;child class constructor - it&#39;s a good idea to do this so&lt;br /&gt;
that all necessary initialization of the parent class is carried out when a&lt;br /&gt;
child class is instantiated. Child-specific initialization can then be&lt;br /&gt;
done in the child class constructor. Only if a child class does not&lt;br /&gt;
have a constructor, is the parent class constructor automatically called.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You can do this in PHP 4, too. Here&#39;s a PHP 4 version of the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;PolarBear&lt;/code&gt;&lt;br /&gt;
class definition:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 4&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// extended class definition&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;PolarBear&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;extends&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// constructor&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;PolarBear&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;parent&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;::&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;colour&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;white&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;600&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define methods&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;swim&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$this&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; is swimming...&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
}&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
To prevent a class or its methods from being inherited, use the&lt;br /&gt;
&lt;b style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;final&lt;/b&gt;&amp;nbsp;keyword before the class or method name (this is new in PHP 5&lt;br /&gt;
and will not work in older versions of PHP). Here&#39;s an example, which&lt;br /&gt;
renders the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear()&lt;/code&gt;&amp;nbsp;class un-inheritable (if that&#39;s actually a&lt;br /&gt;
word):&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// PHP 5&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// class definition&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;final class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define properties&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// define methods&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// extended class definition&lt;br /&gt;&lt;br /&gt;// this will fail because Bear() cannot be extended&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;PolarBear&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;extends&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Bear&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define methods&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create instance of PolarBear()&lt;br /&gt;&lt;br /&gt;// this will fail because Bear() could not be extended&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$bob&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= new&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;PolarBear&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$bob&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;name&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Bobby Bear&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$bob&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;-&amp;gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;weight&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://tcbonlinenow.blogspot.dk/2013/11/php-101-part-7-bear-necessities-part-2.html&quot; style=&quot;border: 0px; color: #4081af; font-family: sans-serif; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;PHP 101 (part 7): The Bear Necessities - Part 2&lt;/a&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/5266025243514246596/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-7-bear-necessities.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/5266025243514246596'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/5266025243514246596'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-7-bear-necessities.html' title='PHP 101 (part 7): The Bear Necessities'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s72-c/php_mysql_logo.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-8800937760231667531</id><published>2013-11-01T10:31:00.000-07:00</published><updated>2013-11-01T10:31:03.108-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP 101 (part 6): Functionally Yours"/><title type='text'>PHP 101 (part 6): Functionally Yours</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s1600/php_mysql_logo.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;185&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s320/php_mysql_logo.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;&lt;/h2&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
A Little Knowledge&lt;/h2&gt;
&lt;hr style=&quot;background-color: #e6e6e6; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; height: 1px; line-height: 21px; margin-bottom: 20px;&quot; /&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If you’ve been taking your regular dose of PHP 101, you know now enough about PHP to write&lt;br /&gt;simple programs of your own. However, these programs will be “procedural” or linear – the&lt;br /&gt;statements in them will be executed sequentially, one after another – simply because that’s&lt;br /&gt;the only programming style I’ve used so far.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You know what they say about a little knowledge being a dangerous thing… as your PHP&lt;br /&gt;scripts become more and more complex, it’s only a matter of time before you bump your head&lt;br /&gt;against the constraints of the procedural method, and begin looking for a more efficient&lt;br /&gt;way of structuring your PHP programs.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
That’s where Part Six of PHP 101 comes in. In this tutorial I’m going to introduce you to&lt;br /&gt;a new way of doing things, where code doesn’t run in a straight line, but twists, leaps&lt;br /&gt;and bounds across the landscape of your script. Most of this activity is accomplished&lt;br /&gt;through a programming construct called a “function”, and this tutorial teaches you how to&lt;br /&gt;build them (once), use them (many times), pass them arguments and have them return values,&lt;br /&gt;and generally make your scripts more compact, efficient and maintainable.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading2&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;/div&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In Plain English&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Ask a geek to define the term “function”, and he’ll probably mumble something about a&lt;br /&gt;function being “a block of statements that can be grouped together as a named entity.”&lt;br /&gt;Since this is a tutorial on PHP, not an introductory course in Greek, I’ll translate that&lt;br /&gt;for you: a function is simply a set of program statements which perform a specific task,&lt;br /&gt;and which can be “called”, or executed, from anywhere in your program.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Every programming language comes with its own built-in functions, and typically also allows&lt;br /&gt;developers to define their own functions. For example, if I had a profit statement for the&lt;br /&gt;year on my desk, and I wanted to inflate each number by 35%, I could call my neighborhood&lt;br /&gt;accounting firm and get them to do it for me… or I could write a simple PHP function called&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;cheatTheShareholders()&lt;/code&gt;&amp;nbsp;and have it do the work for me (it’s faster, plus PHP&lt;br /&gt;doesn’t bill by the hour).&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
There are three important reasons why functions are a Good Thing™. First: user-defined&lt;br /&gt;functions allow you to separate your code into easily identifiable subsections – which are&lt;br /&gt;easier to understand and debug. Second: functions make your program modular, allowing you&lt;br /&gt;to write a piece of code once and then re-use it multiple times within the same program. And&lt;br /&gt;third: functions simplify code updates or changes, because the change needs only to be&lt;br /&gt;implemented in a single place (the function definition). Functions thus save time, money&lt;br /&gt;and electrons… and I know the electrons at least will thank you!&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading3&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Monday Morning Blues&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
To see how a function works, look at the following example:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define a function&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;myStandardResponse&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Get lost, jerk!&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// on the bus&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Hey lady, can you spare a dime? &amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;myStandardResponse&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// at the office&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Can you handle Joe&#39;s workload, in addition to your own, while he&#39;s in Tahiti for a month? You&#39;ll probably need to come in early and work till midnight, but we are confident you can handle it. Oh, and we can&#39;t pay you extra because of budgetary constraints...&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;myStandardResponse&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// at the party&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Hi, haven&#39;t I seen you somewhere before?&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;myStandardResponse&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s what the output might look like:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Hey lady, can you spare a dime?
Get lost, jerk!

Can you handle Joe&#39;s workload, in addition to your own, while he&#39;s in Tahiti for a month?
You&#39;ll probably need to come in early and work till midnight, but we are confident you can
handle it. Oh, and we can&#39;t pay you extra because of budgetary constraints...
Get lost, jerk!

Hi, haven&#39;t I seen you somewhere before?
Get lost, jerk!
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
(Sure it’s rude, but it does demonstrate how a function allows you to reuse pieces of code.)&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The first thing I’ve done in the script above is define a new function, with the&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&lt;/code&gt;&amp;nbsp;keyword. This keyword is followed by the name of the function, which&lt;br /&gt;in this case is&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;myStandardResponse()&lt;/code&gt;. All the program code attached to that&lt;br /&gt;function is then placed within a pair of curly braces – and this program code can contain&lt;br /&gt;loops, conditional statements, calls to other user-defined functions, or calls to other&lt;br /&gt;PHP functions.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Of course, defining a function is only half of the puzzle; for it to be of any use at all,&lt;br /&gt;you need to “invoke” it. In PHP, as in a million other languages, this is accomplished&lt;br /&gt;by calling the function by its name, as I’ve done in the example above. Calling a&lt;br /&gt;user-defined function is identical to calling a built-in PHP function like&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo()&lt;/code&gt;&lt;br /&gt;or&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;explode()&lt;/code&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s the typical format for a function:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;function function_name (optional function arguments) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;statement 1...&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;statement 2...&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;statement n...&lt;br /&gt;&lt;br /&gt;}&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading4&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Having an Argument… or Two&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Functions like the one you saw in the previous section print the same value every time&lt;br /&gt;you invoke them. While this is interesting the first six times, it can get boring on the&lt;br /&gt;seventh. What we need to do, to make these boring, unintelligent functions a little more&lt;br /&gt;exciting, is get them to return a different value each time they are invoked.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Enter arguments.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Arguments work by using a placeholder to represent a certain variable within a function.&lt;br /&gt;Values for this variable are provided to the function at run-time from the main program.&lt;br /&gt;Since the input to the function will differ at each invocation, so will the output.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
To see how this works, look at the following function, which accepts a single argument&lt;br /&gt;and then prints it back after a calculation:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define a function&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getCircumference&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$radius&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Circumference of a circle with radius $radius is &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sprintf.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sprintf&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;%4.2f&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;, (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;*&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$radius&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;*&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.pi.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;pi&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;())).&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// call a function with an argument&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getCircumference&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// call the same function with another argument&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getCircumference&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;20&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In this example, when the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getCircumference()&lt;/code&gt;&amp;nbsp;function is called with an&lt;br /&gt;argument, the argument is assigned to the placeholder variable&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$radius&lt;/code&gt;&amp;nbsp;within&lt;br /&gt;the function, and then acted upon by the code within the function definition.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
It’s also possible to pass more than one argument to a function. This is done using a&lt;br /&gt;comma-separated list, as the following example shows:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define a function&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;changeCase&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$flag&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/* check the flag variable and branch the code */&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;switch(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$flag&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;U&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.strtoupper.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;strtoupper&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;).&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;case&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;L&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.strtolower.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;strtolower&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;).&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;default:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// call the function&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;changeCase&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;The cow jumped over the moon&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;U&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;changeCase&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Hello Sam&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;L&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here, depending on the value of the second argument, program flow within the function&lt;br /&gt;moves to the appropriate branch and manipulates the first argument.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Note that there is no requirement to specify the data type of the argument being passed&lt;br /&gt;to a function. Since PHP is a dynamically-typed language, it automatically identifies&lt;br /&gt;the variable type and acts on it appropriately.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading5&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Circles in the Sand&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The functions on the previous page simply printed their output to the screen. But what&lt;br /&gt;if you want the function to do something else with the result? Well, in PHP, you can&lt;br /&gt;have a function return a value, such as the result of a calculation, to the statement&lt;br /&gt;that called it. This is done using a&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;return&lt;/code&gt;&amp;nbsp;statement within the function,&lt;br /&gt;as shown below:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define a function&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getCircumference&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$radius&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// return value&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;return (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;*&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$radius&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;*&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.pi.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;pi&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;());&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/* call a function with an argument and store the result in a variable */&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$result&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getCircumference&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/* call the same function with another argument and print the return value */&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getCircumference&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;20&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here, the argument passed to the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getCircumference()&lt;/code&gt;&amp;nbsp;function is processed, and&lt;br /&gt;the result is returned to the main program, where it may be captured in a variable, printed,&lt;br /&gt;or dealt with in other ways.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You can even use the result of a function inside another function, as illustrated in this&lt;br /&gt;minor revision of the example above:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define a function&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getCircumference&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$radius&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// return value&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;return (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;*&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$radius&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;*&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.pi.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;pi&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;());&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print the return value after formatting it&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;The answer is &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.sprintf.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;sprintf&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;%4.2f&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getCircumference&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;20&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;));&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Return values need not be numbers or strings alone: a function can just as easily return&lt;br /&gt;an array (remember them?), as demonstrated in the following example:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/* define a function that can accept a list of email addresses */&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getUniqueDomains&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$list&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/* iterate over the list, split addresses and add domain part to another array */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$domains&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= array();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;foreach (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$list&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$l&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$arr&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.explode.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;explode&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;@&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$l&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$domains&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[] =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.trim.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;trim&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$arr&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// remove duplicates and return&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;return&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.array-unique.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;array_unique&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$domains&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// read email addresses from a file into an array&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fileContents&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.file.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;file&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;data.txt&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/* pass the file contents to the function and retrieve the result array */&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$returnArray&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getUniqueDomains&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fileContents&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// process the return array&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;foreach (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$returnArray&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$d&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;$d, &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Assuming the file looked like this,&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;test@test.com
a@x.com
zooman@deeply.bored.org
b@x.com
guess.me@where.ami.net
testmore@test.com
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
the output of the script above would look like this:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;test.com, x.com, deeply.bored.org, where.ami.net,
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Note that the return statement terminates program execution inside a function.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading6&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Marching Order&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The order in which arguments are passed to a function can be important. The following example&lt;br /&gt;requires that the name is passed as the first argument, and the place as the second.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define a function&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;introduce&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$place&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Hello, I am $name from $place&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// call function&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;introduce&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Moonface&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;The Faraway Tree&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
This is the output:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Hello, I am Moonface from The Faraway Tree
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In this example, if you reversed the order in which arguments were passed to the function,&lt;br /&gt;this is what you’d see:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Hello, I am The Faraway Tree from Moonface
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
And look what happens if you forget to pass a required argument altogether:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Warning: Missing argument 2 for introduce() in xx.php on line 3
Hello, I am Moonface from 
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In order to avoid such errors, PHP allows you to specify default values for all the&lt;br /&gt;arguments in a user-defined function. These default values are used if the function&lt;br /&gt;invocation is missing some arguments. Here’s an example:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define a function&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;introduce&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$name&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;John Doe&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$place&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;London&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Hello, I am $name from $place&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// call function&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;introduce&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Moonface&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In this case the output would be:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Hello, I am Moonface from London

&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Notice that the function has been called with only a single argument, even though the function&lt;br /&gt;definition requires two. However, since default values are present for each argument in the&lt;br /&gt;function, the missing argument is replaced by the default value for that argument, and no&lt;br /&gt;error is generated.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading7&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The Amazing Shrinking Argument List&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
All the examples on the previous page have one thing in common: the number of arguments&lt;br /&gt;in the function definition is fixed. However, PHP 4.x also supports variable-length&lt;br /&gt;argument lists, by using the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;func_num_args()&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;func_get_args()&lt;/code&gt;&lt;br /&gt;commands. For want of a better name, these functions are called “function functions”.&lt;br /&gt;Try wrapping your tongue around that while you look at the next example, which&lt;br /&gt;demonstrates how they can be used:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define a function&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;someFunc&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get the arguments&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$args&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.func-get-args.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;func_get_args&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print the arguments&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;You sent me the following arguments:&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;foreach (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$args&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$arg&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; $arg &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// call a function with different arguments&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;someFunc&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;red&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;green&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;blue&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;someFunc&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;soap&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Hmmm… if you’re sneaky, you might have tried to pass&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;someFunc()&lt;/code&gt;&amp;nbsp;an array, and&lt;br /&gt;found that instead of displaying the elements of the array, it simply said “Array”. You can&lt;br /&gt;fix this by adding a quick test for array arguments inside the function, as in this rewrite:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define a function&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;someFunc&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get the number of arguments passed&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$numArgs&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.func-num-args.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;func_num_args&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// get the arguments&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$args&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.func-get-args.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;func_get_args&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print the arguments&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;You sent me the following arguments: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$x&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$x&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$numArgs&lt;/span&gt;;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$x&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;++) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;&amp;lt;br /&amp;gt;Argument $x: &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/* check if an array was passed and, if so, iterate and print contents */&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.is-array.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;is_array&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$args&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$x&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; ARRAY &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;foreach (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$args&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$x&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$index&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$element&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; $index =&amp;gt; $element &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot; $args[$x] &quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// call a function with different arguments&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;someFunc&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;red&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;green&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;blue&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;, array(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;),&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;yellow&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading8&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Going Global&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Let’s now talk a little bit about the variables used within a function, and their&lt;br /&gt;relationship with variables in the outside world. Usually, the variables used within&lt;br /&gt;a function are “local” – meaning that the values assigned to them, and the changes made&lt;br /&gt;to them, are restricted to the function space alone.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Consider this simple example:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define a variable in the main program&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$today&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Tuesday&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define a function&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getDay&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define a variable inside the function&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$today&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Saturday&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print the variable&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;It is $today inside the function&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// call the function&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getDay&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print the variable&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;It is $today outside the function&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
When you run this script, here is what you will see:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;It is Saturday inside the function
It is Tuesday outside the function
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In other words, the variable inside the function is insulated from the identically-named&lt;br /&gt;variable in the main program. Variables inside a function are thus aptly called “local”&lt;br /&gt;variables because they only exist within the function in which they are defined.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The reverse is also true: variables defined inside a function cannot be “seen” outside&lt;br /&gt;it. To illustrate, take a look at the next example and its output (or the lack of it):&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define a function&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getDay&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define a variable inside the function&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$today&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Saturday&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getDay&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;br /&gt;&lt;br /&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Today is $today&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here is the output:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Today is 
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Depending on the error_reporting you have set up in php.ini, you might also see an error&lt;br /&gt;message:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Notice: Undefined variable: today in x1.php on line 10&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
However, I didn’t say this can’t be overcome. To have variables within a function accessible&lt;br /&gt;from outside it (and vice-versa), all you need to do is first declare them “global” with&lt;br /&gt;the – you guessed it! –&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;global&lt;/code&gt;&amp;nbsp;keyword.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here is a rewrite of the earlier example, this time declaring the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$today&lt;/code&gt;&lt;br /&gt;variable global:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define a variable in the main program&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$today&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Tuesday&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define a function&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getDay&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;() {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// make the variable global&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;global&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$today&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// define a variable inside the function&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$today&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Saturday&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print the variable&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;It is $today inside the function&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
}&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print the variable&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;It is $today before running the function&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// call the function&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getDay&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print the variable&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;It is $today after running the function&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
And here is the output:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;It is Tuesday before running the function
It is Saturday inside the function
It is Saturday after running the function
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Thus, once a variable is declared global, it is available at the global level, and can be&lt;br /&gt;manipulated both inside and outside a function.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
PHP also comes with so-called superglobal variables – variables that are always available,&lt;br /&gt;regardless of whether you’re inside a function or outside it. You’ve already seen some of&lt;br /&gt;these special variables in action: the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/code&gt;&amp;nbsp;and&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_GET&lt;/code&gt;&amp;nbsp;variables are all superglobals, which is why you can access things&lt;br /&gt;like the currently-executing script’s name or form values even inside a function.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Superglobals are a Good Thing™, because they’re always there when you need them,&lt;br /&gt;and you don’t need to jump through any hoops to use the data stored inside them. Read more&lt;br /&gt;about superglobals and variable scope at&lt;a br=&quot;&quot; href=&quot;&quot;&gt;href=&quot;http://www.php.net/manual/en/language.variables.predefined.php&quot;&amp;gt;http://www.php.net/manual/en/language.variables.predefined.php&lt;br /&gt;and&lt;a br=&quot;&quot; href=&quot;&quot;&gt;href=&quot;http://www.php.net/manual/en/language.variables.scope.php&quot;&amp;gt;http://www.php.net/manual/en/language.variables.scope.php.&lt;/a&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;Heading9&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Checking References&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Any discussion about variables in and out of functions would be incomplete without some&lt;br /&gt;mention of the difference between “passing by reference” and “passing by value”. So far,&lt;br /&gt;all the examples you’ve seen have involved passing arguments to a function “by value” -&lt;br /&gt;meaning that a copy of the variable was passed to the function, while the original&lt;br /&gt;variable remained untouched. However, PHP also allows you to pass “by reference” – meaning&lt;br /&gt;that instead of passing a value to a function, you pass a reference to the original&lt;br /&gt;variable, and have the function act on that instead of a copy.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Confusing? Well, this is probably easier to understand with an example. Let’s start with this:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create a variable&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$today&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Saturday&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// function to print the value of the variable&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;setDay&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$day&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$day&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Tuesday&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;It is $day inside the function&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// call function&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;setDay&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$today&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print the value of the variable&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;It is $today outside the function&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You’ve already seen this before, and you already know what the output is going to say:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;It is Tuesday inside the function
It is Saturday outside the function
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
This is because when the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;getDay()&lt;/code&gt;&amp;nbsp;function is invoked, it passes the value&lt;br /&gt;“Saturday” to the function (“passing by value”). The original variable remains untouched;&lt;br /&gt;only its content is sent to the function. The function then acts on the content, modifying&lt;br /&gt;and displaying it.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Now, look at how “passing by reference” works:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create a variable&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$today&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Saturday&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// function to print the value of the variable&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;setDay&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&amp;amp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$day&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$day&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Tuesday&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;It is $day inside the function&amp;lt;br /&amp;gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// call function&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;setDay&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$today&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print the value of the variable&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;It is $today outside the function&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Notice the ampersand (&amp;amp;) before the argument in the function definition. This tells&lt;br /&gt;PHP to use the variable reference instead of the variable value. When such a reference&lt;br /&gt;is passed to a function, the code inside the function acts on the reference, and modifies&lt;br /&gt;the content of the original variable (which the reference is pointing to) rather than a&lt;br /&gt;copy. If you then try retrieving the value of the original variable outside the function,&lt;br /&gt;it returns the modified value:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.
It is Tuesday inside the function
It is Tuesday outside the function
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Now you understand why I said no discussion about variables would be complete without&lt;br /&gt;mentioning the two ways of passing variables. This, of course, is what the&lt;br /&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;global&lt;/code&gt;&amp;nbsp;keyword does inside a function: use a reference to ensure that changes&lt;br /&gt;to the variable inside the function also reflect outside it. The PHP manual puts it best&lt;br /&gt;when it says “…when you declare a variable as&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;global $var&lt;/code&gt;&amp;nbsp;you are in fact&lt;br /&gt;creating a reference to a global variable”. For more examples, read all about references&lt;br /&gt;at&amp;nbsp;&lt;a href=&quot;http://www.zend.com/manual/language.references.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;http://www.zend.com/manual/language.references.php&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
And that just about concludes this tutorial. This time you’ve taken a big step towards&lt;br /&gt;better software design by learning how to abstract parts of your PHP code into reusable&lt;br /&gt;functions. You now know how to add flexibility to your functions by allowing them to accept&lt;br /&gt;different arguments, and how to obtain one (or more) return values from them. Finally, you’ve&lt;br /&gt;learned a little bit about how PHP treats variables inside and outside functions.&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In&amp;nbsp;&lt;a href=&quot;http://devzone.zend.com/article/638&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;Part Seven&lt;/a&gt;, I’ll be showing you how to group related&lt;br /&gt;functions together into classes, and also telling you all about the cool new features&lt;br /&gt;in the PHP 5 object model. You definitely don’t want to miss that one!&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/8800937760231667531/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-6-functionally-yours.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/8800937760231667531'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/8800937760231667531'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/11/php-101-part-6-functionally-yours.html' title='PHP 101 (part 6): Functionally Yours'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s72-c/php_mysql_logo.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4109498437077009704.post-2543124827495360442</id><published>2013-10-30T13:58:00.002-07:00</published><updated>2013-10-31T12:42:50.399-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP 101 (part 5): Rank and File"/><title type='text'>PHP 101 (part 5): Rank and File</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s1600/php_mysql_logo.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;185&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s320/php_mysql_logo.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/h2&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Back to School&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
When you first started reading this series, I promised you that&lt;br /&gt;
you’d have a whole lot of fun. If you’re the cynical type, you may be&lt;br /&gt;
feeling that I didn’t keep my promise. After all, how much fun have you&lt;br /&gt;
&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;really&lt;/i&gt;&amp;nbsp;had so far? All you’ve done is learn a bunch of&lt;br /&gt;
theoretical rules, added and subtracted numbers from each other, learnt&lt;br /&gt;
primitive decision-making and gone round and round in the circular&lt;br /&gt;
funhouse of loops. Heck, if this wasn’t a PHP tutorial, it would be&lt;br /&gt;
kindergarten…&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
I hear you.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In this segment of our ongoing saga, I’m going to teach you how to&lt;br /&gt;
do something that’s definitely not for kids. It involves getting down&lt;br /&gt;
and dirty with files on the disk: meeting them (shock!), reading their&lt;br /&gt;
contents (shriek!) and (horror of horrors!) writing data to them. All&lt;br /&gt;
of these exciting activities will take place under the aegis of PHP’s&lt;br /&gt;
very cool file manipulation API, which allows you to view and modify&lt;br /&gt;
file attributes, read and list directory contents, alter file&lt;br /&gt;
permissions, retrieve file contents into a variety of native data&lt;br /&gt;
structures, and search for files based on specific patterns.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Let’s get started!&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading2&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Handle With Care&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
I’ll begin with something simple: opening a file and reading its&lt;br /&gt;
contents. Let’s assume that somewhere on your disk, hidden under&lt;br /&gt;
/usr/local/stuff/that/should/be/elsewhere/recipes/, you have a text&lt;br /&gt;
file containing the recipe for the perfect Spanish omelette. You now wish&lt;br /&gt;
to read the contents of this file into a PHP script.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In order to do this, there are three distinct steps to be&lt;br /&gt;
followed:&lt;/div&gt;
&lt;ul style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; list-style: none; margin: 0px 0px 1.5em; outline: 0px; padding: 0px 0px 0px 30px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Open the file and assign it a file handle.&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Interact with the file, via its handle, and extract its contents&lt;br /&gt;into a PHP variable.&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Close the file.&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s a PHP script that does just that:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set file to read&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;/usr/local/stuff/that/should/be/elsewhere/recipes/omelette.txt&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Could not open file!&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fh&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.fopen.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;fopen&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;r&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Could not open file!&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// read file contents&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.fread.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;fread&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fh&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.filesize.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;filesize&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;)) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Could not read file!&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.fclose.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;fclose&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fh&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print file contents&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Run this script through your Web browser, and PHP should return the&lt;br /&gt;
contents of the file.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Now let me explain each of the three steps above in detail:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading3&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h3 align=&quot;left&quot; style=&quot;background-color: #fafafa; border: 1px solid rgb(222, 222, 222); color: #363636; font-family: &#39;Droid Serif&#39;, serif; font-size: 14px; font-weight: normal; height: 20px; line-height: 1em; margin: 0px 0px 15px; outline: 0px; padding: 10px 18px 5px; vertical-align: baseline;&quot;&gt;
Open the file and assign it a file handle&lt;/h3&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
PHP needs a file handle to read data from a file. This file handle&lt;br /&gt;
can be created with the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fopen()&lt;/code&gt;&amp;nbsp;function, which accepts two arguments:&lt;br /&gt;
the name and path to the file, and a string indicating the “mode” in&lt;br /&gt;
which the file is to be opened (&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;r&#39;&lt;/code&gt;&amp;nbsp;for read).&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Three different modes are available for use with the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fopen()&lt;/code&gt;&lt;br /&gt;
function. Here’s the list:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;r&#39;&lt;/code&gt;&amp;nbsp;– opens a file in read mode&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;w&#39;&lt;/code&gt;&amp;nbsp;– opens a file in write mode, destroying existing file&lt;br /&gt;
contents&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;a&#39;&lt;/code&gt;&amp;nbsp;– opens a file in append mode, preserving existing file&lt;br /&gt;
contents&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading4&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h3 align=&quot;left&quot; style=&quot;background-color: #fafafa; border: 1px solid rgb(222, 222, 222); color: #363636; font-family: &#39;Droid Serif&#39;, serif; font-size: 14px; font-weight: normal; height: 20px; line-height: 1em; margin: 0px 0px 15px; outline: 0px; padding: 10px 18px 5px; vertical-align: baseline;&quot;&gt;
Interact with the file via its handle and extract its contents&lt;br /&gt;into a PHP variable&lt;/h3&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fopen()&lt;/code&gt;&amp;nbsp;function is successful, it returns a file handle,&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fh&lt;/code&gt;, which can be used for further interaction with the file. This file&lt;br /&gt;
handle is used by the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fread()&lt;/code&gt;&amp;nbsp;function, which reads the file and places&lt;br /&gt;
its contents into a variable.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The second argument to&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fread()&lt;/code&gt;&amp;nbsp;is the number of bytes to be read.&lt;br /&gt;
You can usually obtain this information through the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;filesize()&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
function, which – who’d have guessed it?!- returns the size of the&lt;br /&gt;
file in bytes.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading5&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h3 align=&quot;left&quot; style=&quot;background-color: #fafafa; border: 1px solid rgb(222, 222, 222); color: #363636; font-family: &#39;Droid Serif&#39;, serif; font-size: 14px; font-weight: normal; height: 20px; line-height: 1em; margin: 0px 0px 15px; outline: 0px; padding: 10px 18px 5px; vertical-align: baseline;&quot;&gt;
Close the file&lt;/h3&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
This last step is not strictly necessary as PHP closes the file&lt;br /&gt;
automatically once it reaches the end of the script, but it’s a good&lt;br /&gt;
habit to develop. Explicitly closing the file with&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fclose()&lt;/code&gt;&amp;nbsp;has two&lt;br /&gt;
advantages: it ties up loose ends in your script, and it wins you lots&lt;br /&gt;
of good karma from the PHP community.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
You probably haven’t see the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;die()&lt;/code&gt;&amp;nbsp;function before, either. This&lt;br /&gt;
function is mostly used as a primitive error-handling mechanism. In the&lt;br /&gt;
event of a fatal error, such as the file path being invalid or the file&lt;br /&gt;
permissions being such that PHP cannot read it,&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;die()&lt;/code&gt;&amp;nbsp;terminates script&lt;br /&gt;
processing and optionally displays a user-specified error message&lt;br /&gt;
indicating why it committed suicide.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading6&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Different Strokes&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
An alternative method of reading data from a file is the very cool&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;file()&lt;/code&gt;&amp;nbsp;function, which reads the entire file into an array (remember&lt;br /&gt;
them?) with one line of code. Each element of the array then contains&lt;br /&gt;
one line from the file. To display the contents of the file, simply&lt;br /&gt;
iterate over the array in a&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;foreach()&lt;/code&gt;&amp;nbsp;loop and print each element.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The following example demonstrates:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set file to read&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;/usr/local/stuff/that/should/be/elsewhere/recipes/omelette.txt&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Could not read file!&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// read file into array&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.file.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;file&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Could not read file!&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// loop through array and print each line&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;foreach (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$line&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$line&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
In this example, the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;file()&lt;/code&gt;&amp;nbsp;command opens the file, reads it into an&lt;br /&gt;
array and closes the file – all in one, single, elegant movement. Each&lt;br /&gt;
element of the array now corresponds to a line from the file. It’s easy&lt;br /&gt;
to print the file’s contents now – just reach for that mainstay of&lt;br /&gt;
array processing, the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;foreach()&lt;/code&gt;&amp;nbsp;loop.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Don’t want the data in an array? Try the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;file_get_contents()&lt;/code&gt;&lt;br /&gt;
function, new in PHP 4.3.0 and PHP 5.0, which reads the entire file&lt;br /&gt;
into a string:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set file to read&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;/usr/local/stuff/that/should/be/elsewhere/recipes/omelette.txt&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;nbsp;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// read file into string&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.file-get-contents.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;file_get_contents&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Could not read file!&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print contents&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Who am I kidding? I always use the one-line functions noted above&lt;br /&gt;
instead of the three-line sequence of&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fopen()&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fread()&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fclose()&lt;/code&gt;.&lt;br /&gt;
Laziness conquers all.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading7&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
When Laziness is a Virtue&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
PHP also offers two very useful functions to import files into a PHP&lt;br /&gt;
script: the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;include()&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;require()&lt;/code&gt;functions. These functions can be&lt;br /&gt;
used to suck external files lock, stock and barrel into a PHP script,&lt;br /&gt;
which is very handy if, for example, you have a modular application&lt;br /&gt;
which has its code broken down across files in separate locations.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The best way to understand the utility of the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;include()&lt;/code&gt;&amp;nbsp;and&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;require()&lt;/code&gt;&amp;nbsp;functions is with an example. Assume that on your Web site&lt;br /&gt;
you have a standard menu bar at the top of every page, and a standard&lt;br /&gt;
copyright notice in the bottom. Instead of copying and pasting the&lt;br /&gt;
header and footer code on each individual page, PHP gurus simply create&lt;br /&gt;
separate files for the header and footer, and import them at the top&lt;br /&gt;
and bottom of each script. This also makes a change to the site design&lt;br /&gt;
easier to implement: instead of manually editing a gazillion files, you&lt;br /&gt;
simply edit two, and the changes are reflected across your entire site&lt;br /&gt;
instantaneously.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Let’s see a real live example of this in action. Create the header&lt;br /&gt;
in one file, called&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;header.php&lt;/code&gt;:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;title&amp;gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$page&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;title&#39;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;];&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- top menu bar --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;table width=&quot;90%&quot; border=&quot;0&quot; cellspacing=&quot;5&quot; cellpadding=&quot;5&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Home&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Site Map&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;td&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Search&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;td&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;Help&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- header ends --&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Next, create the footer with the copyright notice in a second file,&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;footer.php&lt;/code&gt;:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!-- footer begins --&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;br /&amp;gt;&lt;br /&gt;&amp;lt;center&amp;gt;Your usage of this site is subject to its published &amp;lt;a href=&quot;tac.html&quot;&amp;gt;terms and conditions&amp;lt;/a&amp;gt;. Data is copyright Big Company Inc, 1995-&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.date.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;date&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Y&quot;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.mktime.php&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;mktime&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;());&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;lt;/center&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Finally, create a script to display the main content of your site,&lt;br /&gt;
and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;include()&lt;/code&gt;&amp;nbsp;the header and footer at appropriate places:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// create an array to set page-level variables&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$page&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;= array();&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$page&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;title&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;] =&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Product Catalog&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/* once the file is imported, the variables set above will become available to it */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
// include the page header&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;include(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;header.php&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- HTML content here --&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// include the page footer&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;include(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;footer.php&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Now, when you run the script above, PHP will automatically read in&lt;br /&gt;
the header and footer files, merge them with the HTML content, and&lt;br /&gt;
display the complete page to you. Simple, isn’t it?&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Notice that you can even write PHP code inside the files being&lt;br /&gt;
imported. When the file is first read in, the parser will look for&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php...?&amp;gt;&lt;/code&gt;&amp;nbsp;tags, and automatically execute the code inside it.&lt;br /&gt;
(If you’re familiar with JavaScript, you can use this feature to&lt;br /&gt;
replicate functionality similar to that of the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;onLoad()&lt;/code&gt;&amp;nbsp;page event&lt;br /&gt;
handler in JavaScript.)&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
PHP also offers the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;require_once()&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;include_once()&lt;/code&gt;functions,&lt;br /&gt;
which ensure that a file which has already been read is not read again.&lt;br /&gt;
This can come in handy if you have a situation in which you want to&lt;br /&gt;
eliminate multiple reads of the same include file, either for&lt;br /&gt;
performance reasons or to avoid corruption of the variable space.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
A quick note on the difference between the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;include()&lt;/code&gt;&amp;nbsp;and&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;require()&lt;/code&gt;functions: the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;require()&lt;/code&gt;function returns a fatal error if the&lt;br /&gt;
named file cannot be found and halts script processing, while the&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;include()&lt;/code&gt;&amp;nbsp;function returns a warning but allows script processing to&lt;br /&gt;
continue.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading8&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Writing to Ma&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
After everything you’ve just read, you’ve probably realized that&lt;br /&gt;
reading a file is not exactly brain surgery. So let’s proceed to&lt;br /&gt;
something slightly more difficult – writing to a file.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The steps involved in writing data to a file are almost identical to&lt;br /&gt;
those involved in reading it: open the file and obtain a file handle,&lt;br /&gt;
use the file handle to write data to it, and close the file. There are&lt;br /&gt;
two differences: first, you must&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fopen()&lt;/code&gt;&amp;nbsp;the file in write mode (&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;w&#39;&lt;/code&gt;&lt;br /&gt;
for write), and second, instead of using the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fread()&lt;/code&gt;&amp;nbsp;function to read&lt;br /&gt;
from the file handle, use the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fwrite()&lt;/code&gt;&amp;nbsp;function to write to it. Take a&lt;br /&gt;
look:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set file to write&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;/tmp/dump.txt&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// open file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fh&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.fopen.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;fopen&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;w&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Could not open file!&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// write to file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.fwrite.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;fwrite&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fh&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Look, Ma, I wrote a file!&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Could not write to file&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// close file&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.fclose.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;fclose&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$fh&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
When you run this script, it should create a file named&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;dump.txt&lt;/code&gt;&amp;nbsp;in&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/tmp&lt;/code&gt;, and write a line of text to it, with a carriage return at the&lt;br /&gt;
end. Notice that double quotes are needed to convert&lt;br /&gt;
into a carriage&lt;br /&gt;
return.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
The&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fopen()&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fwrite()&lt;/code&gt;&amp;nbsp;and&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fread()&lt;/code&gt;&amp;nbsp;functions are all binary-safe,&lt;br /&gt;
which means you can use them on binary files without worrying about&lt;br /&gt;
damage to the file contents. Read more about many of the issues related&lt;br /&gt;
to binary-safe file manipulation on different platforms at&lt;a href=&quot;http://devzone.zend.com/266/php-101-part-5-rank-and-file/%3Cbr&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;&quot;http://www.php.net/manual/en/function.fopen.php&quot; target=&quot;_blank&quot; target=&#39;blank&#39;&amp;gt;http://www.php.net/manual/en/function.fopen.php&lt;/a&gt;.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If I’ve spoiled you by showing you the one-line shortcut functions&lt;br /&gt;
for file reads, let me damage you further by introducing you to the&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;file_put_contents()&lt;/code&gt;&amp;nbsp;function, new in PHP 5.0, which takes a string and&lt;br /&gt;
writes it to a file in a single line of code.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// set file to write&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$filename&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;/tmp/dump.txt&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// write to file&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.file-put-contents.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;file_put_contents&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$filename&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&quot;Look, Ma, I wrote a file!&lt;br /&gt;&quot;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Could not write to file&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Bear in mind that the directory in which you’re trying to create the&lt;br /&gt;
file must exist before you can write to it. Forgetting this important&lt;br /&gt;
step is a common cause of script errors.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading9&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Information is Power&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
PHP also comes with a bunch of functions that allow you to test the&lt;br /&gt;
status of a file – for example to find out whether it exists, whether&lt;br /&gt;
it’s empty, whether it’s readable or writable, and whether it’s a&lt;br /&gt;
binary or text file. Of these, the most commonly used operator is the&lt;br /&gt;
&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;file_exists()&lt;/code&gt;&amp;nbsp;function, which is used to test for the existence of a&lt;br /&gt;
specific file.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Here’s an example which asks the user to enter the path to a file in&lt;br /&gt;
a Web form, and then returns a message displaying whether or not the&lt;br /&gt;
file exists:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// if form has not yet been submitted&lt;br /&gt;&lt;br /&gt;// display input box&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;form action=&quot;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;PHP_SELF&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;];&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&quot; method=&quot;post&quot;&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Enter file path &amp;lt;input type=&quot;text&quot; name=&quot;file&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/form&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// else process form input&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// check if file exists&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// display appropriate message&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.file-exists.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;file_exists&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;File exists!&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;File does not exist!&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
There are many more such functions. Here’s a brief list, followed by&lt;br /&gt;
an example that builds on the previous one to provide more information&lt;br /&gt;
on the file specified by the user.&lt;/div&gt;
&lt;ul style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; list-style: none; margin: 0px 0px 1.5em; outline: 0px; padding: 0px 0px 0px 30px; vertical-align: baseline;&quot;&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;is_dir()&lt;/code&gt;&amp;nbsp;– returns a Boolean indicating whether the specified path&lt;br /&gt;is a directory&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;is_file()&lt;/code&gt;&amp;nbsp;– returns a Boolean indicating whether the specified file&lt;br /&gt;is a regular file&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;is_link()&lt;/code&gt;&amp;nbsp;– returns a Boolean indicating whether the specified file&lt;br /&gt;is a symbolic link&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;is_executable()&lt;/code&gt;&amp;nbsp;– returns a Boolean indicating whether the&lt;br /&gt;specified file is executable&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;is_readable()&lt;/code&gt;- returns a Boolean indicating whether the specified&lt;br /&gt;file is readable&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;is_writable()&lt;/code&gt;- returns a Boolean indicating whether the specified&lt;br /&gt;file is writable&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;filesize()&lt;/code&gt;&amp;nbsp;– gets size of file&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;filemtime()&lt;/code&gt;&amp;nbsp;– gets last modification time of file&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;filamtime()&lt;/code&gt;&amp;nbsp;– gets last access time of file&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fileowner()&lt;/code&gt;&amp;nbsp;– gets file owner&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;filegroup()&lt;/code&gt;&amp;nbsp;– gets file group&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;fileperms()&lt;/code&gt;&amp;nbsp;– gets file permissions&lt;/li&gt;
&lt;li style=&quot;background-color: transparent; border: 0px; list-style-type: disc; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;filetype()&lt;/code&gt;&amp;nbsp;– gets file type&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
This script asks for a file name as input and uses the functions&lt;br /&gt;
above to return information on it.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/* if form has not yet been submitted, display input box */&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (!isset(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;form action=&quot;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_SERVER&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;PHP_SELF&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;];&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&quot; method=&quot;post&quot;&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Enter file path &amp;lt;input type=&quot;text&quot; name=&quot;file&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/form&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// else process form input&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;else {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;File name: &amp;lt;b&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]&amp;nbsp;&amp;nbsp;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&amp;lt;/b&amp;gt;&amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/* check if file exists and display appropriate message */&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.file-exists.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;file_exists&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print file size&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;File size: &#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.filesize.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;filesize&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]).&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39; bytes&amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print file owner&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;File owner: &#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.fileowner.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;fileowner&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]).&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print file group&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;File group: &#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.filegroup.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;filegroup&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]).&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print file permissions&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;File permissions: &#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.fileperms.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;fileperms&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]).&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print file type&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;File type: &#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.filetype.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;filetype&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;]).&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print file last access time&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;File last accessed on: &#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.date.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;date&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Y-m-d&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.fileatime.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;fileatime&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])).&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// print file last modification time&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;File last modified on: &#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.date.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;date&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Y-m-d&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.filemtime.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;filemtime&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])).&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;&amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// is it a directory?&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.is-dir.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;is_dir&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;File is a directory &amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// is it a file?&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.is-file.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;is_file&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;File is a regular file &amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// is it a link?&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.is-link.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;is_link&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;File is a symbolic link &amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// is it executable?&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.is-executable.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;is_executable&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;File is executable &amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// is it readable?&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.is-readable.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;is_readable&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;File is readable &amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// is it writable?&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.is-writable.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;is_writable&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$_POST&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;file&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;])) {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;File is writable &amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;File does not exist! &amp;lt;br /&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
And here’s what the output might look like:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;File name: /usr/local/apache/logs/error_log
File size: 53898 bytes
File owner: 0
File group: 0
File permissions: 33188
File type: file
File last accessed on: 2004-05-26
File last modified on: 2004-06-20
File is a regular file
File is readable
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.blogger.com/blogger.g?blogID=4109498437077009704&quot; name=&quot;Heading10&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;h2 align=&quot;left&quot; style=&quot;background-color: white; border: 0px; color: #222222; font-family: &#39;Droid Serif&#39;, serif; font-size: 1.8em; font-weight: normal; line-height: 1.5em; margin: 0px 0px 0.5em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Breaking Eggs&lt;/h2&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
So now you know how to read a file, write to it, and test its&lt;br /&gt;
status. Let’s look at some examples of what you can do with this&lt;br /&gt;
new-found power.&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
Let’s go back to my Spanish omelette recipe. Let’s suppose I’m feeling&lt;br /&gt;
generous, and I decide that I’d like to hear what people&amp;nbsp;&lt;i style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;really&lt;/i&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
think about my culinary skills. Since I have a bunch of recipes that&lt;br /&gt;
I’d like to share with people, and since they all look something like&lt;br /&gt;
this:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;SPANISH OMELETTE
INGREDIENTS:
- 1 chopped onion
- 1 chopped tomato
- 1/2 chopped green pepper
- 4 beaten eggs
- Salt and pepper to taste
METHOD:
1. Fry onions in a pan
2. Pour beaten eggs over onions and fry gently
3. Add tomatoes, green pepper, salt and pepper to taste
4. Serve with toast or bread
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
I need a quick way to convert them all into HTML so that they look&lt;br /&gt;
presentable on my Web site. We’ve already established that I’m lazy, so&lt;br /&gt;
fuggedaboutme re-creating the recipes in HTML. Instead, I’ll have PHP&lt;br /&gt;
do the heavy lifting for me:&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;span style=&quot;background-color: transparent; border: 0px; color: black; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// read recipe file into array&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.file.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;file&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;/usr/local/stuff/that/should/be/elsewhere/omelette.txt&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) or die(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #dd0000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&#39;Could not read file!&#39;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/* first line contains title: read it into variable */&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$title&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;];&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;// remove first line from array&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.array-shift.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;array_shift&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;lt;h2&amp;gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$title&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&amp;lt;/h2&amp;gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #ff8000; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;/* iterate over content and print it */&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;foreach (&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$data&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;as&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$line&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;) {&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;border: 0px; font-family: sans-serif; font-size: 14px; line-height: 1.5em; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;a href=&quot;http://devzone.zend.com/manual/function.nl2br.php&quot; style=&quot;border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;_blank&quot;&gt;nl2br&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;$line&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #007700; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;);&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;span style=&quot;border: 0px; color: #0000bb; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/code&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
I’ve used the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;file()&lt;/code&gt;&amp;nbsp;function to read the recipe into an array, and&lt;br /&gt;
assign the first line (the title) to a variable. That title is then&lt;br /&gt;
printed at the top of the page. Since the rest of the data is fairly&lt;br /&gt;
presentable as is, I can simply print the lines to the screen one after&lt;br /&gt;
the other. Line breaks are automatically handled for me by the&lt;br /&gt;
extremely cool&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;nl2br()&lt;/code&gt;&amp;nbsp;function, which converts regular text linebreaks&lt;br /&gt;
into the HTML equivalent, the&amp;nbsp;&lt;code style=&quot;background-color: transparent; border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;br /&amp;gt;&lt;/code&gt;&amp;nbsp;tag. The end result: an&lt;br /&gt;
HTML-ized version of my recipe that the world can marvel at. Take a look:&lt;/div&gt;
&lt;pre style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;

&amp;lt;h2&amp;gt;SPANISH OMELETTE
&amp;lt;/h2&amp;gt;
INGREDIENTS:&amp;lt;br /&amp;gt;
- 1 chopped onion&amp;lt;br /&amp;gt;
- 1 chopped tomato&amp;lt;br /&amp;gt;
- 1/2 chopped green pepper&amp;lt;br /&amp;gt;
- 4 beaten eggs&amp;lt;br /&amp;gt;

- Salt and pepper to taste&amp;lt;br /&amp;gt;
METHOD:&amp;lt;br /&amp;gt;
1. Fry onions in a pan&amp;lt;br /&amp;gt;
2. Pour beaten eggs over onions and fry gently&amp;lt;br /&amp;gt;
3. Add tomatoes, green pepper, salt and pepper to taste&amp;lt;br /&amp;gt;
4. Serve with toast or bread&amp;lt;br /&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/div&gt;
&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;code class=&quot;tutorialExample&quot; style=&quot;background-color: white; border: 0px; color: #555555; font-size: 14px; line-height: 21px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;/code&gt;&lt;span style=&quot;background-color: white; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;background-color: white; border: 0px; color: #555555; font-family: sans-serif; font-size: 14px; line-height: 21px; margin-bottom: 1.4em; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
If the elegance and creative simplicity of my Spanish omelette recipe&lt;br /&gt;
has left you speechless, I’m not surprised – many people feel that&lt;br /&gt;
way. Until you get your voice back: Ciao… and make sure you come back&lt;br /&gt;
to work through&amp;nbsp;&lt;a href=&quot;http://devzone.zend.com/article/637&quot; style=&quot;background-color: transparent; border: 0px; color: #4081af; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;Part Six&lt;/a&gt;&amp;nbsp;of PHP 101,&lt;br /&gt;
which discusses creating your own reusable functions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tcbonlinenow.blogspot.com/feeds/2543124827495360442/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/10/php-101-part-5-rank-and-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/2543124827495360442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4109498437077009704/posts/default/2543124827495360442'/><link rel='alternate' type='text/html' href='http://tcbonlinenow.blogspot.com/2013/10/php-101-part-5-rank-and-file.html' title='PHP 101 (part 5): Rank and File'/><author><name>Camchatter</name><uri>http://www.blogger.com/profile/06339103089492166587</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQoHtcryqhmlBPuWEvTOKR_RRV_VKxcO0CscUvUK0vFSE7BbLSIOhKs4s4eSrhO-rHsMz14hjwrRGK5ygnYDx7jynpXt-a7Vhjb_zHaOAGXDcYMlP3Vg6whfd6UtKXX6f3m8OI1E0Df_w/s72-c/php_mysql_logo.png" height="72" width="72"/><thr:total>0</thr:total></entry></feed>