<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>» DoYourself.org &#187; PHP</title>
	<atom:link href="http://www.doyourself.org/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.doyourself.org</link>
	<description>Did you know ?</description>
	<lastBuildDate>Fri, 03 Feb 2012 23:00:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>WordPress Zlib Compression Functions in PHP</title>
		<link>http://www.doyourself.org/php/1095-wordpress-zlib-compression-functions-in-php/</link>
		<comments>http://www.doyourself.org/php/1095-wordpress-zlib-compression-functions-in-php/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 10:17:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[compression]]></category>
		<category><![CDATA[Functions]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[zlib]]></category>

		<guid isPermaLink="false">http://www.doyourself.org/php/1095-wordpress-zlib-compression-functions-in-php/</guid>
		<description><![CDATA[Compressing your Web pages will help your WordPress site load faster and, according to Google, may even improve its search engine rank. A compression format called zlib is built into the Apache Web server and supported by PHP as well as all widely used Web browsers. You can use zlib functionality to speed up your blog.<!--more-->]]></description>
			<content:encoded><![CDATA[<p></p><h2>WordPress Zlib Compression Functions in PHP</h2>
<p><img src="http://photos.demandstudios.com/getty/article/178/128/78490394_XS.jpg" alt="WordPress Zlib Compression Functions in PHPthumbnail" align="left" border="0"><br/><br />
<h3>Instructions:</h3>
<h2 class="header Heading3">What is zlib?</h2>
<p>The zlib compression format was created by the creators of zip and gzip compression to enable fast compression and decompression across platforms and software. Initially created as lossless image compression, zlib is commonly used for output compression, or compacting Web pages on demand as they are delivered to a browser, which in turn decompresses the page for viewing. This entire process is invisible to the user.</p>
<h2 class="header Heading3">PHP and zlib</h2>
<p>PHP offers zlib support on all platforms. The Windows version of PHP activates the zlib module by default, but an administrator must activate the module for other platforms. Once zlib is active, developers can make use of its output compression functions within their PHP code. The Apache Web server also includes a zlib module for output compression, and if the PHP module is not active, a Web developer can tune Apache&#8217;s zlib functionality via the site&#8217;s .htaccess file.</p>
<h2 class="header Heading3">WordPress and zlib</h2>
<p>WordPress itself does not make use of zlib, normally counting on Apache or PHP to compress its output. However, if zlib is enabled in PHP but not configured to compress output by default, a WordPress administrator can add the following line to the site&#8217;s index.php file to enable zlib compression:</p>
<p>ob_start(&#8216;ob_gzhandler&#8217;);</p>
<p>Some WordPress plugins also enable zlib compression if it&#8217;s detected, but use alternate methods of compression if zlib is not available.</p>
<h2 class="header Heading3">Coding zlib Functions in PHP</h2>
<p>The PHP documentation includes detailed functions and code examples for using zlib within PHP code, including compressing and decompressing specific items on the server or obtaining information from compressed files. Elements such as images and style sheets can be compressed using zlib functions. To determine whether the PHP zlib module is active, create a text file named test.php and paste in the following line:</p>
<p>&lt;?php phpinfo(); ?&gt;</p>
<p>Upload the file to the Web server and then navigate using a Web browser to the file&#8217;s location. Look for the zlib library on the resulting page. If it doesn&#8217;t appear, contact your Web hosting provider or use Apache&#8217;s zlib functionality.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doyourself.org/php/1095-wordpress-zlib-compression-functions-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Vs. Perl Performance</title>
		<link>http://www.doyourself.org/php/1093-php-vs-perl-performance/</link>
		<comments>http://www.doyourself.org/php/1093-php-vs-perl-performance/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 10:17:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.doyourself.org/php/1093-php-vs-perl-performance/</guid>
		<description><![CDATA[Computer programmers use a variety of programming languages when designing Web pages. No one programming language is &#34;better in terms of comparison, and each has its strengths and weaknesses, although certain languages are better suited for particular tasks on the Web. When comparing PHP and Perl, it's important to realize that both have an role in the architecture of Web pages, and one language may offer some advantages over the other, depending on what you want to achieve.<!--more-->]]></description>
			<content:encoded><![CDATA[<p></p><h2>PHP Vs. Perl Performance</h2>
<p><img src="http://photos.demandstudios.com/getty/article/129/85/87464712_XS.jpg" alt="PHP Vs. Perl Performancethumbnail" align="left" border="0"><br/><br />
<h3>Instructions:</h3>
<h2 class="header Heading3">How PHP and Perl Work</h2>
<p>Perl, short for Practical Extraction and Reporting Language, is a high-level, general-purpose programming language. PHP, which derives its name from &#8220;Hypertext Preprocessor,&#8221; is a more basic, server-side scripting language. In terms of output, PHP is coded directly into the HTML of a website, and it can add dynamic features to layout features controlled by HTML. Perl is a set of general commands that actually generate Web pages on the fly. Both are dynamic languages, which means they adjust to prompts from users and programmers, but Perl can be used to create a framework in which a website functions, while PHP is a concrete part of the website.</p>
<h2 class="header Heading3">Advantages of PHP: Detail and Precision</h2>
<p>As an integral part of website code, PHP can be a good choice for complex websites with numerous features. Rather than having to code a long series of conditions and exceptions into a Perl framework to accommodate diverse functionality, PHP allows coders to design different features individually and inside the code. Both programming languages can be used to achieve nearly identical sites, but PHP&#8217;s targeted scripting can make for less cumbersome code and faster performance on detail-oriented sites.</p>
<h2 class="header Heading3">Advantages of Perl: Functionality and Control</h2>
<p>If PHP is a scalpel, Perl is a jackhammer. Perl can control nearly every part of a website from a single framework, achieving much more control over the code than PHP scripts that control single areas or conditions. Perl is often used for sites that have to manage large amounts of data but offer a relatively simple front-end interface for users. In these situations, the high-octane power of Perl simplifies coding and can enhance performance by establishing conditions and prompts that affect all of the content on the site.</p>
<h2 class="header Heading3">Historical Perspectives</h2>
<p>Perl was introduced in 1987, while PHP did not emerge on the scene until 1995, which gives Perl the advantages of maturity, acceptance and a strong community of programmers familiar with the code. Virtually every Web server is capable of running Perl code, and the language has a more robust, time-tested set of commands. The popularity of PHP, however, has lead to the rapid development of an increasingly sophisticated set of features that now rival Perl&#8217;s capacity for many Web projects, as well as quick setup of PHP servers. As both languages continue to mature, the natural evolution of Web-based programming will continue to find new niches and specialties for each.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doyourself.org/php/1093-php-vs-perl-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Count in MySQL Results</title>
		<link>http://www.doyourself.org/php/1094-php-count-in-mysql-results/</link>
		<comments>http://www.doyourself.org/php/1094-php-count-in-mysql-results/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 10:17:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[count]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[results]]></category>

		<guid isPermaLink="false">http://www.doyourself.org/php/1094-php-count-in-mysql-results/</guid>
		<description><![CDATA[When developers create websites using the PHP language and a MySQL database, they can carry out various types of data query. Sometimes a developer will need to determine the number of database table rows resulting from a query, so that they can structure these results within HTML markup. This task can be achieved using both SQL and PHP functions. Both options require only a few lines of code.<!--more-->]]></description>
			<content:encoded><![CDATA[<p></p><h2>PHP Count in MySQL Results</h2>
<p><img src="http://photos.demandstudios.com/getty/article/178/165/78491565_XS.jpg" alt="PHP Count in MySQL Resultsthumbnail" align="left" border="0"><br/><br />
<h3>Instructions:</h3>
<h2 class="header Heading3">SQL Queries</h2>
<p>Developers working with MySQL databases can execute SQL queries on them. Within these queries, a developer can specify a particular set of data, referencing table and column names. The results of a query may include multiple records. Depending on the application, this may mean that the developer has no idea how many records a query will return, which can pose a problem when presenting data within a Web interface in PHP. This is where count queries can prove useful.</p>
<h2 class="header Heading3">Querying From PHP</h2>
<p>Websites built using server side scripts in PHP can use standard functions to execute queries on MySQL databases in SQL. The PHP for a website normally handles retrieving data from the database, then iterating through the results, presenting some or all of the data items within HTML markup structures that the user will ultimately see on viewing the page. If a PHP script is building query results into HTML, it may therefore need to know how many records it is dealing with. In some cases, query results are split across multiple HTML pages.</p>
<h2 class="header Heading3">MySQL Count</h2>
<p>The count function in SQL allows developers to determine the number of records a particular query will return. The following sample code demonstrates a count query:<br />
SELECT COUNT(*) FROM customer;</p>
<p>This returns the total number of records in the specified table. To return the number of distinct values in a particular table column, the developer could use the following version:<br />
SELECT COUNT(DISTINCT firstname) FROM customer;</p>
<p>To execute a count query from a PHP script, developers use the following syntax:<br />
$count_query = &quot;SELECT COUNT(DISTINCT firstname) FROM customer&quot;;<br />
$result = mysql_query($count_query);</p>
<p>This gives the script a reference to the number of rows in the data returned from the query.</p>
<h2 class="header Heading3">PHP Number of Rows</h2>
<p>Within a PHP script, developers can use language functions to determine the number of records in a query result set, rather than executing a count query specifically to retrieve that information. The following sample code demonstrates:<br />
$query = &quot;SELECT * FROM customer&quot;;<br />
$result = mysql_query($query);<br />
$num_records = mysql_num_rows($result);</p>
<p>This allows the developer to determine the number of records without having to carry out a separate query. Otherwise there may be a need to execute one query to get the data and another to find out how many records are in it. The &quot;mysql_num_rows&quot; function returns an integer that the script can refer to when building webpage HTML.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doyourself.org/php/1094-php-count-in-mysql-results/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux, Apache, MySQL &amp; PHP for Beginners</title>
		<link>http://www.doyourself.org/php/1091-linux-apache-mysql-php-for-beginners/</link>
		<comments>http://www.doyourself.org/php/1091-linux-apache-mysql-php-for-beginners/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 10:17:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[beginners]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.doyourself.org/php/1091-linux-apache-mysql-php-for-beginners/</guid>
		<description><![CDATA[Although the amount of jargon and the sheer volume of code used in many applications can make the world of computer programming seem daunting, most coding technologies and languages are actually quite straightforward. Even for beginners, once users have a solid grasp of the underlying logic and structure of each language or technology, they should find that inputting commands and beginning to program is rather simple and intuitive. First, however, beginners should be familiar with what each language or technology is and does. Apache, MySQL, Linux and PHP, for instance, are terms and technologies about which every beginner should know some basic information.<!--more-->]]></description>
			<content:encoded><![CDATA[<p></p><h2>Linux, Apache, MySQL &#038; PHP for Beginners</h2>
<p><img src="http://photos.demandstudios.com/getty/article/28/209/E014646_XS.jpg" alt="Linux, Apache, MySQL &amp; PHP for Beginnersthumbnail" align="left" border="0"><br/><br />
<h3>Instructions:</h3>
<h2 class="header Heading3">PHP: Scripting Language</h2>
<p>Hypertext Preprocessor is a server-side scripting language, meaning that PHP is written directly into the code of a Web application, usually accompanied by HTML. While HTML is primarily used for formatting and aesthetic issues such as colors and alignment, however, PHP is a dynamic language that manages different prompts from users and coders. In other words, PHP is used to manage the changing attributes of a website. If a programmer wants a picture to change when the user puts his mouse over it, for example, a PHP command can be used to first establish the condition (mouse over image) and the result (image changes). These commands are often coded as simple &quot;if/then&quot; statements.</p>
<h2 class="header Heading3">Linux: Operating System</h2>
<p>Linux is not a programming language but an entire operating system, an application used to manage all of the applications and files on a computer. Similar to competitors such as Windows and Mac OS X, Linux basically organizes all of the information on a computer so that users can run programs, look for documents, open folders and display information. Unlike Windows and Mac operating systems, Linux is based on free and open-source software distribution. The operating system is available for download free from the organization&#8217;s website and the code is open and available to all programmers who wish to make a change. The only condition is that they publish their changes, setting in motion a process by which the code is continually improved by thousands of individual inputs and re-released to the public in successive and improved versions.</p>
<h2 class="header Heading3">Apache: Web Server Software</h2>
<p>In addition to the script that determines what a certain website looks like or how it behaves, the process by which users access a website also requires software management. Apache is one such software, known as server software, that manages the server in which the site&#8217;s information is stored and the different requests that come into that server from users &#8211; everything from making sure the website pops up when a user enters the Web address to providing the website with the information it needs when a user selects a different page or section to view. Just think of a server as a big hard drive and server software as the operating system. Essentially, Apache&#8217;s server software executes scripting languages such as PHP, organizing the code stored on the server and making sure it has the information it needs when a user requests it. Apache also offers supplementary services such as user authentication and secure server navigation and, like Linux, is an open-source project.</p>
<h2 class="header Heading3">MySQL: A Database Management System</h2>
<p>MySQL is a relational database management system used to handle huge amounts of data and numerous requests for that data. MySQL acts like a database server full of information that allows multiple users to query the database at the same time. Facebook and Twitter, for example, use MySQL database management to store all the information users input and then allow other users to ask for that information and view it on their computers. MySQL is an open-source project and free versions of the system are available for non-commercial websites, although large for-profit users must purchase paid versions with added support features.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doyourself.org/php/1091-linux-apache-mysql-php-for-beginners/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CGI Perl Vs. PHP</title>
		<link>http://www.doyourself.org/php/1092-cgi-perl-vs-php/</link>
		<comments>http://www.doyourself.org/php/1092-cgi-perl-vs-php/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 10:17:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.doyourself.org/php/1092-cgi-perl-vs-php/</guid>
		<description><![CDATA[Perl and PHP are two of the &#34;three P's&#34; that complete the  Linux, Apache, MySQL or &#8220;LAMP&#8221; Web server software stack. While both Perl and PHP are general purpose programming languages, they also make good Common Gateway Interface or CGI scripting languages. CGI is a World Wide Web standard that specifies the interaction between Web servers and the Perl or PHP applications that send or receive information through them. Blogging platforms, social networking sites, Web email, online dating services and Internet-based courses are some of the Web applications created using Perl or PHP CGI scripts.<!--more-->]]></description>
			<content:encoded><![CDATA[<p></p><h2>CGI Perl Vs. PHP</h2>
<p><img src="http://photos.demandstudios.com/getty/article/129/6/78527028_XS.jpg" alt="CGI Perl Vs. PHPthumbnail" align="left" border="0"><br/><br />
<h3>Instructions:</h3>
<h2 class="header Heading3">Perl History</h2>
<p>Larry Wall created Perl as a tool to simplify the creation and processing of reports  under the UNIX operating system environment. The name Perl was originally a contraction of the word Pearl. Today, the name has become an acronym for &quot;Practical Extraction and Report Language.&quot; The language has grown to include all the features you would expect in a modern programming language. Perl is often used to write short and simple scripts. Perl code is interpreted language rather than compiled. Perl has dynamic rather than static variable typing like C++ or Java.  Recent versions of Perl even support object-oriented programming.  You can find versions of Perl running on Linux, Windows, Mac OS X and other UNIX-like systems.</p>
<h2 class="header Heading3">Perl CGI Applications</h2>
<p>Perl interpreters are a standard component on many UNIX, Linux and BSD Web servers. This has helped make Perl a widely used CGI language. While some Web servers support Perl scripts embedded within Web pages, the majority of Perl scripts are files stored on a server that are loaded by the Web server and executed by the language interpreter.  According to the website, &quot;Perl Web Development,&quot;  Movable Type, Bugzilla and cPanel,  Amazon,  Priceline Craigslist, IMDb, LiveJournal, Slashdot and Ticketmaster are examples of Web applications built using Perl scripts.</p>
<h2 class="header Heading3">PHP History</h2>
<p>Rasmus Lerdorf invented the PHP programming language as a tool to help him maintain his personal website. In fact, according to an article on the official PHP website, Ledorf called his language &quot;Personal Home Page Tools.&quot; Today, PHP  stands for &quot;PHP: Hypertext Preprocessor.&quot;  PHP was gradually grown to include access to multiple databases, embedding within  HTML or HyperText Markup Language code, multiple operating system support,  HTTP sessions, performance-enhancing output buffering, regular expressions and object-oriented programming. Like Perl, PHP is an interpreted language with dynamic data typing.</p>
<h2 class="header Heading3">PHP CGI Applications</h2>
<p>PHP code is usually embedded in Web pages, but like Perl, PHP scripts can be run as files stored on a server. You can write PHP CGI scripts to process Web forms, perform text transformations, read and write files, perform mathematical calculations and access Web server and operating system details. WordPress blogs, Facebook, Joomla and Drupal websites and Wikipedia are all programmed using PHP.</p>
<h2 class="header Heading3">Similarities and Differences</h2>
<p>While Perl and PHP CGI scripts are generally used for same Web programming chores, they are very different looking languages. Perl code closely resembles scripts written to use UNIX text processing utilities such as sed and AWK. PHP code and coding syntax, however, will be quite familiar to C or C++ programmers. Both Perl and PHP are supported by large communities that freely share code and documentation. Perl programmers can access CPAN or the Comprehensive Perl Archive Network for Perl modules they can use in their scripts. PHP programmers have a comparable code repository in  PECL or the PHP Extension Community Library.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doyourself.org/php/1092-cgi-perl-vs-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parse Error in PHP</title>
		<link>http://www.doyourself.org/php/1089-parse-error-in-php/</link>
		<comments>http://www.doyourself.org/php/1089-parse-error-in-php/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 10:17:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[parse]]></category>

		<guid isPermaLink="false">http://www.doyourself.org/php/1089-parse-error-in-php/</guid>
		<description><![CDATA[When developers write programming scripts in any language, the likelihood of errors can be high. The PHP scripting language is no exception. Developers use PHP code to build websites and Web applications. Often, PHP scripts contain code in other languages, such as HTML markup for defining webpages and SQL for managing databases. When a PHP site contains an error in the syntax, the webpage may display a message indicating that a parse error has been detected.<!--more-->]]></description>
			<content:encoded><![CDATA[<p></p><h2>Parse Error in PHP</h2>
<p><img src="http://photos.demandstudios.com/getty/article/142/5/56472874_XS.jpg" alt="Parse Error in PHPthumbnail" align="left" border="0"><br/><br />
<h3>Instructions:</h3>
<h2 class="header Heading3">Causes</h2>
<p>Parse errors in PHP are caused by mistakes in code syntax. Developers can include accidental syntax errors in PHP scripts in many ways, such as forgetting to include a semicolon at the end of a statement, as follows:<br />
echo &quot;hello&quot;<br />
$my_num=5;</p>
<p>The first line does not have a semicolon at the end, which may prevent it and subsequent processing from executing correctly. Another common error is forgetting to include closing quotes around a string:<br />
echo &quot;Here is some text;</p>
<p>The missing closing quotes around this string will prevent the echo statement and any lines after it from functioning reliably. Often, PHP scripts include SQL code, as follows:<br />
$data_query=&quot;SELECT * FROM my_table WHERE item_name=&#8217;thing&#8217;&quot;;</p>
<p>The use of both double and single quotes, such as those in the SQL code, can make parse errors more likely.</p>
<h2 class="header Heading3">Effects</h2>
<p>The effects of parse errors vary. Depending on the severity of an error, it may cause a single line or even an entire script to fail. The PHP interpreter works through the lines of code in a linear fashion, processing one line at a time and sometimes using complex control structures, such as loops and conditional statements. A single syntax error in one PHP script may therefore have a severe impact on an entire site or application.</p>
<h2 class="header Heading3">Reporting</h2>
<p>Depending on the server setup for a PHP installation, the Web browser may display error messages that developers can use to locate mistakes. These include parse errors, which often indicate a line number. This line number indicates the line within the script at which the PHP interpreter has detected an error. However, the line number indicated may not be the actual line causing the error, as many syntax errors affect impacting subsequent lines of code. For example, the following syntax error may generate a message indicating the line after the actual error source:<br />
$some_text = &quot;&lt;p&gt;Here is an HTML paragraph&lt;/p&gt;;<br />
echo $some_text;</p>
<p>The error is on the first line, which is missing closing quotes. However the parse error message may indicate the second line or even a line later in the script.</p>
<h2 class="header Heading3">Debugging</h2>
<p>Debugging is a key skill for all programmers, including those working in PHP. The first step in resolving a parse error is locating its source. The error reporting functions in PHP can be helpful in this task, particularly if they indicate line numbers accurately. Often, developers start from the indicated line number for an error and work back from it until they locate the syntax error causing the problem. Once the problem is located, the developer can make alterations to the script and upload it to the server again before testing to see if the error has been resolved.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doyourself.org/php/1089-parse-error-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Parse Options</title>
		<link>http://www.doyourself.org/php/1090-php-parse-options/</link>
		<comments>http://www.doyourself.org/php/1090-php-parse-options/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 10:17:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[options]]></category>
		<category><![CDATA[parse]]></category>

		<guid isPermaLink="false">http://www.doyourself.org/php/1090-php-parse-options/</guid>
		<description><![CDATA[In computer programming, &#34;parsing&#34; means to analyze data, specifically a string of text, for tokens to determine its structure and purpose. PHP has several parsing functions that let you analyze different kinds of strings, such as sentences, dates and URLs. You use these functions to break up the data into an array of its different parts.<!--more-->]]></description>
			<content:encoded><![CDATA[<p></p><h2>PHP Parse Options</h2>
<p><br/><br />
<h3>Instructions:</h3>
<h2 class="header Heading3">The parse_url Function</h2>
<p>PHPs &quot;parse_url&quot; function lets you input a URL and have it broken down into an array that contains its various components. It checks for, and returns the scheme, host, port, user, pass, path, query and fragment, as long as those pieces exist &#8212; not all URLs contain each of these components. You can use partial or whole URLs with this function; however, it alone does not validate that the given URL is complete or safe. You can also include an optional second parameter to the parse_url function to indicate you want it to return a string and not an array.</p>
<h2 class="header Heading3">The date_parse Function</h2>
<p>Similar to PHP&#8217;s URL-parsing function, the &quot;date_parse&quot; function lets you input a date and break it down into its component pieces, each saved as a different element in an array. You can pass a full or partial date; the function will return the components it finds, including the year, month, day, hour, minute, second, fraction, warning_count, warnings, error_count, errors, and whether the date is a local time. The warnings and errors components are both arrays themselves.</p>
<h2 class="header Heading3">The parse_str Function</h2>
<p>PHPs &quot;parse_str&quot; function lets you input a query string that you want to convert to variables. For example, passing &quot;varA=one&amp;varB=two&quot; will create two variables, &quot;varA&quot; and &quot;varB,&quot; with the values &quot;one&quot; and &quot;two,&quot; respectively. The function itself does not return a value by default, but you can choose to save the values to an associative array instead of variables. You will usually use this function as part of a larger process &#8212; for example, such as using the &quot;parse_url&quot; function to extract the query component from a URL, then passing that value to the &quot;parse_str&quot; to save the query to variables.</p>
<h2 class="header Heading3">The preg_match Function</h2>
<p>PHPs &quot;preg_match&quot; function lets you create a list of tokens, called a regular expression, and match those tokens against a string. At a minimum, you must provide a pattern and a string. PHP parses the string with the pattern. You can create a pattern, such as a substring of text or a punctuation character. You can also specify a variable to save the results of the parse into, flags and offset values.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doyourself.org/php/1090-php-parse-options/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP References Vs. Object Handles</title>
		<link>http://www.doyourself.org/php/1087-php-references-vs-object-handles/</link>
		<comments>http://www.doyourself.org/php/1087-php-references-vs-object-handles/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 10:17:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[handles]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[references]]></category>

		<guid isPermaLink="false">http://www.doyourself.org/php/1087-php-references-vs-object-handles/</guid>
		<description><![CDATA[When you create a function and pass parameters to it in PHP: Hypertext Preprocessor, you must understand the scope of the parameters. PHP forces you to specifically declare when to allow a function to modify the global value of a parameter. In PHP version 5, the object model affects how objects are treated when passed as parameters to functions. While the model conforms to the overall PHP standard, it provides a function that allows you to manipulate the global values of object members without specifically declaring this in the function definition.<!--more-->]]></description>
			<content:encoded><![CDATA[<p></p><h2>PHP References Vs. Object Handles</h2>
<p><br/><br />
<h3>Instructions:</h3>
<h2 class="header Heading3">Parameter Scope</h2>
<p>When you pass a variable to a function in PHP and the function modifies the value of the variable, it has no effect on the variable&#8217;s value outside the scope of the function. To allow a function to modify the value of a variable, you must specifically declare this intent by prefixing the variable name with an ampersand in the function definition. For example:</p>
<p>function modify_param,(&amp;param) {<br />
}</p>
<h2 class="header Heading3">Value or Reference</h2>
<p>A function can&#8217;t modify a variable&#8217;s value outside its own scope because PHP passes the variable by value. It creates a copy of the variable&#8217;s value and passes the copy to the function. Any changes to that value affect only the local copy. When you pass by reference using the ampersand in the function definition, PHP passes a pointer to the memory address space containing the value of the variable. Operations on the variable are then performed against the global value of the variable, not a copy of its value.</p>
<h2 class="header Heading3">Passing Objects</h2>
<p>When you pass an object as a parameter to a function, PHP still passes the object by value, but it passes a different kind of value. A copy of an object handle, or identifier, is passed to the function. The object identifier allows the function to find the memory address space where the values of the object members are stored. This means that an object&#8217;s members are actually passed by reference. Operations that use an object&#8217;s properties and methods manipulate the memory address space of those members and change their global values.</p>
<h2 class="header Heading3">Object Handle Copy</h2>
<p>Not all objects in PHP are passed by reference, even though changes to the object members affect global values. A copy of the object handle is passed to a function. If a function makes an assignment that changes the object handle itself, that change does not modify the object handle since it is passed by value. To allow a function to modify the object&#8217;s handle, you must pass the object by reference, just as you would with any other variable in PHP.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doyourself.org/php/1087-php-references-vs-object-handles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A PHP Array Sort Problem With the Number Zero</title>
		<link>http://www.doyourself.org/php/1088-a-php-array-sort-problem-with-the-number-zero/</link>
		<comments>http://www.doyourself.org/php/1088-a-php-array-sort-problem-with-the-number-zero/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 10:17:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[problem:]]></category>
		<category><![CDATA[Sort]]></category>
		<category><![CDATA[with]]></category>
		<category><![CDATA[zero]]></category>

		<guid isPermaLink="false">http://www.doyourself.org/php/1088-a-php-array-sort-problem-with-the-number-zero/</guid>
		<description><![CDATA[PHP will generally act as expected when sorting values including numeric zero, sorting it as less than one and greater than any negative number. The most common sources of error when dealing with zero values stem from how they are used in arrays, or confusing a numeric zero value with the text &#34;0&#34; value.<!--more-->]]></description>
			<content:encoded><![CDATA[<p></p><h2>A PHP Array Sort Problem With the Number Zero</h2>
<p><br/><br />
<h3>Instructions:</h3>
<h2 class="header Heading3">Types of Arrays</h2>
<p>An array is a single variable that holds a list of values. PHP has two kinds of arrays that differ in the way each is referenced by array commands. An array can have a numeric index in which each element of the array is assigned a sequential number, or it can use a keyed index in which a keyword is assigned to each element. For example, both of these are valid PHP arrays:</p>
<p>$family = array(&quot;John&quot;,&quot;Mary&quot;,&quot;Dick&quot;,&quot;Jane&quot;)</p>
<p>$family = array(&quot;father&quot; =&gt; &quot;John&quot;, &quot;mother&quot; =&gt; &quot;Mary&quot;, &quot;son&quot; =&gt; &quot;Dick&quot;, &quot;daughter&quot; =&gt; &quot;Jane&quot;)</p>
<h2 class="header Heading3">Zero-Based Indexes</h2>
<p>PHP uses a zero basis for array indexing, which is the technical way of saying that instead of counting items starting with one, arrays are counted starting with zero. Common sense may indicate that $family[1] is &quot;John&quot;, but this will result in &quot;Mary&quot;. $family[0] is the numeric reference to use to return &quot;John&quot;. Zero-based indexing frequently causes programming errors when one-based indexing is anticipated by the programmer, but this will rarely cause sorting errors since zero is sorted before one as would generally be expected.</p>
<h2 class="header Heading3">String and Numeric Zero</h2>
<p>A more likely cause of sorting errors involving zero is mixing text and numeric value types. PHP distinguishes between the text &quot;0&quot; and the number 0. This differs from other programming languages that use automatic coercion, where the language attempts to convert text containing numeric data into numbers when programming syntax mixes data types. PHP documentation states that sort routines will act erratically when data types are mixed, so confirm that all variables that you expect to hold numeric data actually do so.</p>
<h2 class="header Heading3">Types of Sorting</h2>
<p>PHP has different sort functions for sorting arrays by the contents of the array, or by the keywords assigned to array elements. PHP allows the assignment of the keyword &quot;0&quot; as a named element, which may differ from element 0 of the array. If you are sorting keys in an array, check your keys as well as your array data for mixed data types.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doyourself.org/php/1088-a-php-array-sort-problem-with-the-number-zero/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a Storefront With PHP MySQL</title>
		<link>http://www.doyourself.org/php/1085-building-a-storefront-with-php-mysql/</link>
		<comments>http://www.doyourself.org/php/1085-building-a-storefront-with-php-mysql/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 10:17:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Programming]]></category>
		<category><![CDATA[building]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[storefront]]></category>
		<category><![CDATA[with]]></category>

		<guid isPermaLink="false">http://www.doyourself.org/php/1085-building-a-storefront-with-php-mysql/</guid>
		<description><![CDATA[Web developers often use the MySQL database system and the PHP server-side scripting language to build commercial websites. By modeling the data for a store in MySQL, connecting to it in PHP and building a Web interface using HTML, developers can effectively create an Internet storefront. The final application involves a range of elements working in conjunction with one another, enabling customers able to purchase products through the website.<!--more-->]]></description>
			<content:encoded><![CDATA[<p></p><h2>Building a Storefront With PHP MySQL</h2>
<p><img src="http://photos.demandstudios.com/getty/article/81/175/86511784_XS.jpg" alt="Building a Storefront With PHP MySQLthumbnail" align="left" border="0"><br/><br />
<h3>Instructions:</h3>
<h2 class="header Heading3">Data</h2>
<p>The first stage in building a Web storefront is normally modeling and storing the data. The data for a store typically includes product details, such as item names, images, descriptions and pricing. If the site allows customers to create accounts, the database can also store the details of these, including customer names, addresses and order histories. Site developers usually begin this stage by designing the database using diagrams; they then implement it using SQL statements. The result of this phase is a group of tables with columns representing the data items in the system.</p>
<h2 class="header Heading3">Connectivity</h2>
<p>Once a development team has a completed database system in MySQL, ideally with some or all of the initial data populated in it, they then need to handle connectivity with the database. This is the process of connecting the website storefront to the database. PHP scripting can handle this, with standard language functions for connecting to MySQL databases as well as querying, updating and inserting new data. The PHP scripts for a commercial website bridge the gap between the data and the user interface.</p>
<h2 class="header Heading3">User Interface</h2>
<p>The user interface for a Web store is usually built in HTML. The PHP scripts for a site connect to the database and retrieve the store data &#8212; product details, for example. PHP then builds this data into HTML structures to send to the customer&#8217;s Web browser. For example, when the user clicks a link to a page about a particular product, this causes a PHP script to run on the server. The PHP script connects to the database and queries it for the details of the product; then it structures the results in HTML, which is returned to the browser for the user to view and optionally make a purchase.</p>
<h2 class="header Heading3">Transactions</h2>
<p>Web storefronts implement customer purchases. Many developers opt to use existing code resources to do this, rather than implementing the details themselves. This is partly because the task of processing a payment over the Web presents a number of serious security issues. If customers are entering the details of credit cards or other financial information, it is vital that these are handled securely. Web finance organizations such as PayPal provide automated tools for processing store payments, which many sites choose to implement.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.doyourself.org/php/1085-building-a-storefront-with-php-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

