<?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: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-2063777811819971705</id><updated>2012-01-15T21:58:35.190-08:00</updated><category term='magic functions'/><category term='Errors in php'/><category term='php tips'/><category term='shell script'/><category term='javascript'/><category term='mysql'/><category term='memory management'/><category term='cache'/><category term='php'/><category term='Z-PHP5-cert'/><category term='database design tips'/><category term='php questions'/><category term='oops'/><category term='date'/><category term='css style sheet'/><category term='website security'/><category term='iterators'/><category term='seo'/><category term='design pattern'/><category term='php.ini'/><category term='string functions'/><category term='code optimization'/><category term='php spl'/><category term='q'/><category term='constants'/><category term='php sessions'/><category term='zend'/><category term='file operations'/><category term='zend framework tutorial'/><category term='php functions'/><title type='text'>php tutorials</title><subtitle type='html'>FREE PHP tutorials:function list n syntax,Error messages,cacheing techniques,php4 vs php5,oops php5,free php5 tutorial,Memory management,mysql extension,mysql php tutorial,zend framework tutorial,oops,JavaScript and CSS,htaccess,apache,classes....</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>54</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-5551938638027109774</id><published>2011-07-18T02:20:00.001-07:00</published><updated>2011-07-18T02:36:55.413-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>easy jquery form validator absolute message box</title><content type='html'>Hey all, I was looking for nice and easy form validator in javascript/ jQuery which displays the error messages as absolute div and not block div. Because the most of validators displays messages next to input element or below them.&lt;br /&gt;&lt;br /&gt;The issue with such validators is, some time it becomes very difficult to manage the ui when large no of input elements are there on page and proper space is not there on page. It also makes issues across browsers.&lt;br /&gt;&lt;br /&gt;Solution is : Display absolute error messages.&lt;br /&gt;I found a great great jQuery plug in : &lt;a href="http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/" rel="nofollow"&gt;download from here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This is really very nice form validator in jquery which displays error messages in absolute div. With all best features and customization included.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Here are some custom functions for this plug in.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Allow all ASCII characters with regular expression. - javascript&lt;br /&gt;&lt;code&gt;&lt;br /&gt;function checkAsciiValues(field, rules, i, options){&lt;br /&gt;    &lt;br /&gt;    var value  = field.val();&lt;br /&gt;    var length = value.length;&lt;br /&gt;&lt;br /&gt;        for(var i = 0; i&amp;lt; length; i++){               if(value.charCodeAt(i) &amp;lt; 1 || value.charCodeAt(i) &amp;gt; 255){&lt;br /&gt;      return "* Please enter only ASCII values.";&lt;br /&gt;     }&lt;br /&gt;        }&lt;br /&gt;          }&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;____________________________________________________________________&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-5551938638027109774?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/5551938638027109774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2011/07/easy-jquery-form-validator-absolute.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/5551938638027109774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/5551938638027109774'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2011/07/easy-jquery-form-validator-absolute.html' title='easy jquery form validator absolute message box'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-4130967401112975709</id><published>2011-02-09T08:37:00.000-08:00</published><updated>2011-02-09T11:10:05.519-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='oops'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>What is polymorphism in php?</title><content type='html'>Polymorphism helps a sub class to behave like a parent class. When an object belonging to different data types respond to methods which have a same name, the only condition being that those methods should perform different function.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-4130967401112975709?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/4130967401112975709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2011/02/what-is-polymorphism-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/4130967401112975709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/4130967401112975709'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2011/02/what-is-polymorphism-in-php.html' title='What is polymorphism in php?'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-8154906971324407688</id><published>2011-02-09T08:29:00.000-08:00</published><updated>2011-02-09T08:30:32.329-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cache'/><title type='text'>what are the most common caching policy approaches ?</title><content type='html'>1)Time triggered caching (expiry timestamp).&lt;br /&gt;&lt;br /&gt;2)Content change triggered caching (sensitive content has changed, so cache must be updated).&lt;br /&gt;&lt;br /&gt;3)Manually triggered caching (manually inform the application that information is outdated, and force a new cache creation).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-8154906971324407688?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/8154906971324407688/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2011/02/what-are-most-common-caching-policy.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/8154906971324407688'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/8154906971324407688'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2011/02/what-are-most-common-caching-policy.html' title='what are the most common caching policy approaches ?'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-6137178443680172757</id><published>2011-02-09T08:27:00.000-08:00</published><updated>2011-02-09T08:28:21.086-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='code optimization'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>what are the database space-saving functions available in php ?</title><content type='html'>Use ip2long() and long2ip() to store the IP addresses as Integers instead of storing them as strings, which will reduce the space from 15 bytes to 4 bytes. This will also increase search speed and make it easy to see if a ip falls within a specified range. &lt;br /&gt;&lt;br /&gt;# Use gzcompress() and gzuncompress() to reduce the strings before you store them in a database. &lt;br /&gt;&lt;br /&gt;The gzcompress can compress plain-text up to 90%. The only reason why you shouldn’t use it is when you need full-text indexing capabilities.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-6137178443680172757?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/6137178443680172757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2011/02/what-are-database-space-saving.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/6137178443680172757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/6137178443680172757'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2011/02/what-are-database-space-saving.html' title='what are the database space-saving functions available in php ?'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-3616583045788576976</id><published>2011-02-09T08:24:00.000-08:00</published><updated>2011-02-09T08:31:22.172-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php sessions'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>What is meant by Session Clustering?</title><content type='html'>The Session Manager session support allows multiple server instances to share a common pool of sessions, known as a session cluster. &lt;br /&gt;&lt;br /&gt;Session clustering setting up methods : &lt;br /&gt;&lt;br /&gt;#1)First methods, is to have a NFS shared where session will be store. Setting this is quite easy, just a little modification on php.ini file to change the “session.save_path ? directive to point to the NFS share. The main problem with NFS is on high traffic, NFS share is really slow. So synchronisation and data corruption can arrive and this can be very frustrating.&lt;br /&gt;&lt;br /&gt;#2) The Second method is to use a Database to store session datas. This solution suppose to write custom session handler. The only real problem of this method is that will generate a very big amount of the number of connections and database query. And this required a dedicated server and a cron job to clean all unused session datas.&lt;br /&gt;&lt;br /&gt;#3)The third method is to use the MCache. MCache is a daemon (a server) that deal with session storing only. It support from RAM storage to data serialization in file/fatabase. It is said that MCache access is native as a session handler in PHP, so it’s just about configuration via php.ini … but I did not investigate yet on how to make it work.&lt;br /&gt;&lt;br /&gt;#4)The fourth method is Memcache, another daemon for “distributed memory object caching system ?. Advantage to Memcache, as it’s integrated in PHP as PECL (look at the documentation on how to install). This method can be very interesting as it provide great performance but this will require a single or couple dedicate server of it use.&lt;br /&gt;&lt;br /&gt;#5)The last method is commercialized by Zend. The product is the Zend Platform and integrate many component of some previous Zend products (Zend Server, etc.) and some new products (Zend Core…). The Zend Core is a Cluster manager that can handle multiple server. It can be use to remote debugging (from Zend Server), performance monitoring and sessions replication. As described, there are many advantage using Zend Platform so I could only to advise you to use it simply first to profile your application and for session clustering ! But there are a little probleme, session are replicated from a server to the other servers. So if a server crash maybe the Platform could not have the time to replicate session data. It can result to session destruction. But be sure that Zend know the problem and will surely fix this soon or later.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-3616583045788576976?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/3616583045788576976/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2011/02/what-is-meant-by-session-clustering.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/3616583045788576976'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/3616583045788576976'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2011/02/what-is-meant-by-session-clustering.html' title='What is meant by Session Clustering?'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-418934966183168183</id><published>2011-01-25T20:38:00.000-08:00</published><updated>2011-01-25T20:51:19.248-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php questions'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>common php questions and answers</title><content type='html'>&lt;ol&gt;&lt;li&gt;&lt;b&gt;What does a special set of tags &lt;?= and ?&gt; do in PHP?&lt;/b&gt; - The output is displayed directly to the browser.&lt;/li&gt;&lt;li&gt;&lt;b&gt;What’s the difference between include and require? - &lt;/b&gt;It’s how they handle failures. If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;b&gt;How do you define a constant?&lt;/b&gt; - Via define() directive, like define ("MYCONSTANT", 100);&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;b&gt;Explain the ternary conditional operator in PHP?&lt;/b&gt; - Expression preceding the ? is evaluated, if it’s true, then the expression preceding the : is executed, otherwise, the expression following : is executed.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;b&gt;How do I find out the number of parameters passed into function?&lt;/b&gt; - func_num_args() function returns the number of parameters passed in.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;b&gt;What’s the difference between accessing a class method via -&gt; and via ::?&lt;/b&gt; - :: is allowed to access methods that can perform static operations, i.e. those, which do not require object initialization. :: is called as "scope resolution operator".&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;b&gt;How do you call a constructor for a parent class?&lt;/b&gt; - parent::constructor($value)&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;b&gt;What are the two new error levels introduced in PHP5.3?&lt;/b&gt; - &lt;br /&gt;E_DEPRECATED&lt;br /&gt;&lt;br /&gt;The E_DEPRECATED error level is used to indicate that a function or feature has been deprecated.&lt;br /&gt;E_USER_DEPRECATED&lt;br /&gt;&lt;br /&gt;The E_USER_DEPRECATED level is intended for indicating deprecated features in user code, similarly to the E_USER_ERROR and E_USER_WARNING levels.&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-418934966183168183?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/418934966183168183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2011/01/common-php-questions-and-answers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/418934966183168183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/418934966183168183'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2011/01/common-php-questions-and-answers.html' title='common php questions and answers'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-1544351869780342055</id><published>2009-12-21T21:30:00.001-08:00</published><updated>2009-12-21T21:52:49.814-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='seo'/><title type='text'>Twitter result found in google SERP</title><content type='html'>I was googling out the keyword "codeignitor" and I got this result in google SERP.&lt;br /&gt;I am not using any monkeyscript in my mozilla browser.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_f0FxIJicqBU/SzBZqB_rHBI/AAAAAAAAAAM/ZOkVR3AIncw/s1600-h/google.GIF"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 400px; height: 391px;" src="http://2.bp.blogspot.com/_f0FxIJicqBU/SzBZqB_rHBI/AAAAAAAAAAM/ZOkVR3AIncw/s400/google.GIF" border="0" alt=""id="BLOGGER_PHOTO_ID_5417928930351586322" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-1544351869780342055?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/1544351869780342055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/12/different-result-found-in-google-search.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/1544351869780342055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/1544351869780342055'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/12/different-result-found-in-google-search.html' title='Twitter result found in google SERP'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_f0FxIJicqBU/SzBZqB_rHBI/AAAAAAAAAAM/ZOkVR3AIncw/s72-c/google.GIF' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-6028900872280214171</id><published>2009-11-03T03:42:00.000-08:00</published><updated>2009-11-03T03:43:45.314-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='database design tips'/><title type='text'>Adjacency List Model and Nested Set Model for hierarchical data in MySQL</title><content type='html'>I am working on classifieds website these days. These kind of websites are getting famous these days and they also have average kind of traffic. while working on database designing for websites like classifieds / auction / web directories, we have to take care of few things like &lt;br /&gt;&lt;br /&gt;1. This is a tree structure which may have n levels.&lt;br /&gt;2. And there has to a straight way to traverse from top to bottom and from bottom to top.&lt;br /&gt;3. Strong tree traversal algorithm.&lt;br /&gt;4. Retrieving a Single Path between two nodes.&lt;br /&gt;5. Depth of nodes and depth of sub-tree and lots of other things.&lt;br /&gt;&lt;br /&gt;For this we need a strong table design and relationship structure. In MySQL we can manage this hierarchical data with two different models.&lt;br /&gt;&lt;br /&gt;1. The Adjacency List Model&lt;br /&gt;2. The Nested Set Model&lt;br /&gt;&lt;br /&gt;The Adjacency List Model is a very basic table structure which maintain the column lets say "parent" to maintain the parent child relationship. (It actually hold the PK of parent node). But this model again has some disadvantages, described in brief on the link at the bottom.&lt;br /&gt;&lt;br /&gt;so,I came across a another hierarchical model called as &lt;strong&gt;nested set model&lt;/strong&gt;. In this type of hierarchical data model parent nodes envelope there children. This is based on algorithm called as &lt;strong&gt;preorder tree traversal algorithm&lt;/strong&gt;. This is a very good concept while working on tree structure tables. &lt;br /&gt;&lt;br /&gt;Source of information : http://dev.mysql.com/tech-resources/articles/hierarchical-data.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-6028900872280214171?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/6028900872280214171/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/11/adjacency-list-model-and-nested-set.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/6028900872280214171'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/6028900872280214171'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/11/adjacency-list-model-and-nested-set.html' title='Adjacency List Model and Nested Set Model for hierarchical data in MySQL'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-557839955065253202</id><published>2009-05-19T00:27:00.000-07:00</published><updated>2009-05-19T03:16:44.604-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='php.ini'/><title type='text'>new php.ini directives in php5</title><content type='html'>PHP 5 came up with some new directives in php.ini file. I am writing about all new directives introduced in PHP 5. Heres the list...&lt;br /&gt;&lt;br /&gt;&lt;b&gt;1) mail.force_extra_parameters&lt;/b&gt; : Force the addition of the specified parameters to be passed as extra parameters to the sendmail binary.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2)register_long_arrays&lt;/b&gt; : &lt;br /&gt;&lt;br /&gt;configures the php to allow or disallow the registration of long arrays $HTTP_*_VARS &lt;br /&gt;&lt;br /&gt;possible values : On / Off&lt;br /&gt;&lt;br /&gt;Default:off&lt;br /&gt;&lt;br /&gt;Recommended : If you are not using them then its recommended to keep them off for some performance reasons.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;3) session.hash_function&lt;/b&gt; : &lt;br /&gt;This directive allows us to configure the way of php's session id generation algorithm.&lt;br /&gt;0: MD5   (128 bits)&lt;br /&gt;1: SHA-1 (160 bits)&lt;br /&gt;&lt;br /&gt;possible values : 0 / 1&lt;br /&gt;&lt;br /&gt;Default : 0&lt;br /&gt;&lt;br /&gt;&lt;b&gt;4)session.hash_bits_per_character&lt;/b&gt; : &lt;br /&gt;This directive allows us to define how many bits are stored in each character when converting the binary hash data to something readable.&lt;br /&gt;&lt;br /&gt;possible values : &lt;br /&gt;'4' (0-9, a-f)&lt;br /&gt;'5' (0-9, a-v)&lt;br /&gt;'6' (0-9, a-z, A-Z, "-", ",")&lt;br /&gt;&lt;br /&gt;default : 5&lt;br /&gt;&lt;br /&gt;&lt;b&gt;5) zend.ze1_compatibility_mode&lt;/b&gt; :&lt;br /&gt;This configuration directive allows us to enable or disable the compatibility with zend engine 1 ( which is a php 4 engine). Its set to Off as default and turning it on may affect cloning,casting. Objects are also passed by value instead of pass by reference.&lt;br /&gt;&lt;br /&gt;possible values : On / Off&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-557839955065253202?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/557839955065253202/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/05/new-phpini-directives-in-php5.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/557839955065253202'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/557839955065253202'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/05/new-phpini-directives-in-php5.html' title='new php.ini directives in php5'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-6554657177531896024</id><published>2009-05-07T03:13:00.000-07:00</published><updated>2009-05-07T05:52:31.769-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='iterators'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='php spl'/><title type='text'>Standard PHP Library extension download introduction</title><content type='html'>&lt;u&gt;&lt;b&gt;Standard PHP Library&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;php5 is focused on object oriented strict syntax and object oriented capabilities. Standard php library (SPL) made this job very east. SPL provides all standard set of interfaces for PHP5 to simplify the data access and &lt;b&gt;traverse the aggregate structures&lt;/b&gt;. These structures can be anything like directory traversal,database,arrays kind of structures.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;simple words :&lt;/b&gt; SPL is nothing but a bunch of classes n interfaces which are developed to solve the common problems. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Lets take some examples,&lt;br /&gt;Suppose that you are working on one of the following tasks&lt;br /&gt;1. Database results. &lt;br /&gt;2. Directory traversing n display.&lt;br /&gt;3. Reading file contents.   &lt;br /&gt;&lt;br /&gt;In all of these tasks we have to iterate the results. Like If we fetch data from database then we have to iterate the result set in order to fetch complete data from result set and same thing with file read and directory traversal task also. In all these cases the programming and coding is same ( fetch the main resource and iterate through the result set), but we have to use different set of php functions to handle different resources( for database we use mysql_fetch_array for directory traversal we use readdir() and so on..)&lt;br /&gt;&lt;br /&gt;The classes and interfaces in SPL makes this kind of traversal easy. Lets start with simple DirectoryIterator class.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;SPL can work with following data structures.&lt;/b&gt;&lt;br /&gt;Arrays&lt;br /&gt;objects &lt;br /&gt;heap&lt;br /&gt;doubly link list&lt;br /&gt;stack&lt;br /&gt;Queues&lt;br /&gt;&lt;br /&gt;&lt;b&gt;It provides set of iterators to traverse the objects. List of few iterators&lt;/b&gt;&lt;br /&gt;ArrayIterator&lt;br /&gt;IteratorIterator&lt;br /&gt;DirectoryIterator&lt;br /&gt;CachingIterator&lt;br /&gt;RecursiveIteratorIterator&lt;br /&gt;RecusrsiveCachingIterator&lt;br /&gt;RecursiveDirectoryIterator&lt;br /&gt;SimpleXMLIterator&lt;br /&gt;FilesystemIterator&lt;br /&gt;FilterIterator&lt;br /&gt;GlobIterator&lt;br /&gt;ParentIterator&lt;br /&gt;LimitIterator&lt;br /&gt;&lt;br /&gt;&lt;b&gt;SPL also provides some Interfaces&lt;/b&gt;&lt;br /&gt;SeekableIterator interface&lt;br /&gt;Countable interface&lt;br /&gt;&lt;br /&gt;&lt;b&gt;SPL also provides some exceptions and functions. &lt;a href="http://www.php.net/~helly/php/ext/spl/main.html" target="_ blank" title="complete details of SPL"&gt;click to read complete details of SPL&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;--------------------------------------------------------------------------------&lt;br /&gt;Here is one simple example of DirectoryIterator&lt;br /&gt;&lt;br /&gt;&lt;b&gt;DirectoryIterator&lt;/b&gt;&lt;br /&gt;This is used to iterate through any directory as simple as that.&lt;br /&gt;&lt;?php &lt;br /&gt;// sample php code to iterate through any server directory&lt;br /&gt;foreach(new DirectoryIterator('path/to/dir') as $element):&lt;br /&gt;  echo $element;&lt;br /&gt;endforeach;&lt;br /&gt;?&gt;&lt;br /&gt;&lt;a href="http://codepad.org/z53jS0qa" target="_blank" title="sample Directory iteration with SPL"&gt;sample Directory iteration with SPL&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-6554657177531896024?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/6554657177531896024/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/05/standard-php-library-extension-download.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/6554657177531896024'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/6554657177531896024'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/05/standard-php-library-extension-download.html' title='Standard PHP Library extension download introduction'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-2841268684099061439</id><published>2009-05-07T03:02:00.000-07:00</published><updated>2009-05-07T03:09:18.780-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='php tips'/><title type='text'>language construct in php echo print isset unset empty include</title><content type='html'>&lt;b&gt;What is language construct?&lt;/b&gt;&lt;br /&gt;Language constructs are built in to php and they can be used like a function. But the basic difference between them is the &lt;u&gt;&lt;b&gt;language constructs can't return the anything&lt;/u&gt;&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;language constructs can be used with or without parentheses.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;List of some language constructs in php&lt;/b&gt;&lt;br /&gt;echo(), print(), isset(), unset(), empty(), include(), require(),array(),list()&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-2841268684099061439?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/2841268684099061439/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/05/language-construct-in-php-echo-print.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/2841268684099061439'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/2841268684099061439'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/05/language-construct-in-php-echo-print.html' title='language construct in php echo print isset unset empty include'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-1238639020047532959</id><published>2009-05-06T07:24:00.000-07:00</published><updated>2009-05-06T07:28:44.659-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='php tips'/><title type='text'>how to avoid direct access to file protect files in php</title><content type='html'>If you don't want users to access some files directly from browser then you can simply use following php script on top of such files. &lt;br /&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;// this is first code block&lt;br /&gt;if (realpath(__FILE__) == realpath($_SERVER['SCRIPT_FILENAME'])) &lt;br /&gt;{ &lt;br /&gt;  // tell people trying to access this file directly goodbye... &lt;br /&gt;  exit('This file can not be accessed directly...'); &lt;br /&gt;}  &lt;br /&gt;/ protected code below this.&lt;br /&gt;?&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-1238639020047532959?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/1238639020047532959/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/05/how-to-avoid-direct-access-to-file.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/1238639020047532959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/1238639020047532959'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/05/how-to-avoid-direct-access-to-file.html' title='how to avoid direct access to file protect files in php'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-3656944980326499983</id><published>2009-05-06T02:11:00.000-07:00</published><updated>2009-05-06T02:33:27.428-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>clearstatcache filesystem function clears cached file status</title><content type='html'>&lt;div style="text-align: justify;"&gt;PHP maintains the status of files in &lt;b&gt;internal cache&lt;/b&gt;. If we are using any of the file functions like is_file , is_readable , is_writable, filectime() etc then php stores the information returned by the applied function and if we try to use that same function on the same file in same script then php uses the &lt;b&gt;cached value&lt;/b&gt; even if the file status changes in between two calls. But as any php script time is small only, but we have to keep this in mind while working on long running scripts. So if you are really working on such kind of script then you can use the php built in function to &lt;u&gt;clear the php's internal cached information about the files&lt;/u&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Syntax&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;void clearstatcache(boolean $clear_real_path_cache(default FALSE),string $file_path)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;first parameter  : To clear real path cache or not.&lt;br /&gt;second parameter : Use only when first parameter is TRUE.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;&lt;a href="http://codepad.org/hmYiNjMJ" target="_blank" title="sample file handling functions affected by clearstatcache()"&gt;some functions affected by clearstatcache()&lt;/a&gt;&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-3656944980326499983?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/3656944980326499983/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/05/clearstatcache-filesystem-function.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/3656944980326499983'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/3656944980326499983'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/05/clearstatcache-filesystem-function.html' title='clearstatcache filesystem function clears cached file status'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-1864117945022326216</id><published>2009-05-06T00:27:00.000-07:00</published><updated>2009-05-06T00:52:11.369-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='php tips'/><title type='text'>programming tips tricks performance improvement</title><content type='html'>Here are some of the Tips and tricks which can improve the speed and performance of your php script and may save your resources.(NOTE:I haven't tested all these tips but these are wildly used to improve the performance of the php script.)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Tips while working with strings&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;string concatenation&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;echo 'php', 'developer';  // saves overhead time for string concatenation. &lt;br /&gt;echo 'foo' . 'bar';       // slower..&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Interpolation&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;$variable  = 'this is '.$another_var.' with me'; // faster&lt;br /&gt;$variable  = "this is  $another_var with me";     // slower&lt;br /&gt;&lt;br /&gt;Tip:&lt;br /&gt;Simply use the single quote instead of double quote. &lt;br /&gt;Avoid the string concatenation with (.) if possible.&lt;br /&gt;&lt;!--http://www.sitepoint.com/forums/showthread.php?t=456441--&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-1864117945022326216?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/1864117945022326216/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/05/programming-tips-tricks-performance.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/1864117945022326216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/1864117945022326216'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/05/programming-tips-tricks-performance.html' title='programming tips tricks performance improvement'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-1273469340371731205</id><published>2009-05-05T06:39:00.000-07:00</published><updated>2009-05-07T02:57:58.712-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='file operations'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>simple file handling functions faster than ctype functions</title><content type='html'>Php offers c type functions to handle files. But php also provides some more functions which are simple and faster than all c type functions like fopen() fread() file() etc...&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Example 1&lt;/b&gt;&lt;br /&gt;readfile() function can be used directly to simply read the file and output its contents to standard output. We can use this function instead of c type functions for better performance.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Example 2&lt;/b&gt;&lt;br /&gt;// classic old method&lt;br /&gt;$content = implode("\n", file("filename.txt"));&lt;br /&gt;// it load complete file in  memory and large files can make server over load.&lt;br /&gt;&lt;br /&gt;// New php 4.3.0 method&lt;br /&gt;$content = file_get_contents("filename.txt");&lt;br /&gt;// in this we can specify the limit to load the file. So at least you have control over memory.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;New function in php5.0.0&lt;/b&gt;&lt;br /&gt;file_put_contents('file_path','Data to write',MODE);&lt;br /&gt;&lt;br /&gt;We can write in to any file in one shot. no need to create any file handle separate.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-1273469340371731205?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/1273469340371731205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/05/simple-file-handling-functions-faster.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/1273469340371731205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/1273469340371731205'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/05/simple-file-handling-functions-faster.html' title='simple file handling functions faster than ctype functions'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-5572486494054609464</id><published>2009-05-05T02:09:00.000-07:00</published><updated>2009-05-05T02:18:55.820-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='constants'/><title type='text'>Predefined Constants PHP_VERSION _OS _EOL _PREFIX _BINDIR</title><content type='html'>Php has lots of predefined constants, Here in this post I am writing about very few constants and there sample output.&lt;br /&gt;&lt;br /&gt;[code]&lt;br /&gt;&lt;?php&lt;br /&gt;// the use of come special php predefined constants.&lt;br /&gt;echo PHP_VERSION.PHP_EOL;&lt;br /&gt;echo PHP_OS.PHP_EOL;&lt;br /&gt;echo PHP_PREFIX;&lt;br /&gt;echo PHP_EOL;&lt;br /&gt;echo PHP_BINDIR;&lt;br /&gt;echo PHP_EOL;&lt;br /&gt;echo PHP_CONFIG_FILE_PATH;&lt;br /&gt;echo PHP_EOL;&lt;br /&gt;echo PATH_SEPARATOR;&lt;br /&gt;?&gt;&lt;br /&gt;OUTPUT&lt;br /&gt;5.2.5&lt;br /&gt;Linux&lt;br /&gt;/usr&lt;br /&gt;/usr/bin&lt;br /&gt;/etc/httpd&lt;br /&gt;:&lt;br /&gt;[/code]&lt;br /&gt;&lt;br /&gt;If you simply look at the constants and there output line by line then you can understand there uses easily , its really straight forward.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;List of other constants &lt;/b&gt;&lt;br /&gt;http://in.php.net/reserved.constants&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-5572486494054609464?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/5572486494054609464/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/05/predefined-constants-phpversion-os-eol.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/5572486494054609464'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/5572486494054609464'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/05/predefined-constants-phpversion-os-eol.html' title='Predefined Constants PHP_VERSION _OS _EOL _PREFIX _BINDIR'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-1636005121300142525</id><published>2009-05-03T23:40:00.000-07:00</published><updated>2009-05-04T00:39:50.713-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>setcookie tutorial syntax login example</title><content type='html'>&lt;h2&gt;setcookie tutorial with login example and syntax of function&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;setcookie description&lt;/b&gt;&lt;br /&gt;It simply sets a cookie to be send with HTTP headers. one cookie is set we can access it later with help of following &lt;br /&gt;$_COOKIE['cookie_name']&lt;br /&gt;$_REQUEST['cookie_name']&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;setcookie Syntax&lt;/b&gt;&lt;br /&gt;Boolean setcookie(string $name,string $value,int $expire,string $path,string $domain,bool $secure,bool $httponly ); &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Parameters to the function&lt;/b&gt;&lt;br /&gt;&lt;u&gt;some tips first.&lt;/u&gt;&lt;br /&gt;There is only on parameter which is compulsory that is $name of cookie.&lt;br /&gt;We can skip the parameter by simply putting ("") and 0 for $expire as its a integer. &lt;br /&gt;&lt;br /&gt;string $name    : Name of cookie&lt;br /&gt;&lt;br /&gt;string $value   : Value for cookie.&lt;br /&gt;&lt;br /&gt;int $expire     : Unix timestamp specifying no of seconds the cookie is valid.&lt;br /&gt;                  one day : time()+60*60*24 .. so simple   &lt;br /&gt;                  If its set to 0 then cookie expires after browser close. &lt;br /&gt;&lt;br /&gt;string $path    : The cookie will be available to the specified path only(if specified).&lt;br /&gt;&lt;br /&gt;string $domain  : The domain that the cookie is available.\&lt;br /&gt;&lt;br /&gt;bool $secure    : If its TRUE then it can be set only on secure connection.&lt;br /&gt; &lt;br /&gt;bool $httponly( &gt; php5.2.0) : This option is added in php 5.2.0 and if its set as TRUE then cookie is accessible only through http protocol n not for the external ecripts like javascript.  But not supported in all browsers. So use it on your own risk. But it helps against XSS attacks.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;example n sample code&lt;/b&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;setcookie('cookiename','cokievalue',0);&lt;br /&gt;This will set a cookie with name "cookiename" with value cookivalue and will expire on browser close.&lt;br /&gt;&lt;br /&gt;This can be access at server side like this&lt;br /&gt;$_COOKIE['cookiename'];&lt;br /&gt;&lt;br /&gt;?&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-1636005121300142525?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/1636005121300142525/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/05/setcookie-tutorial-syntax-login-example.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/1636005121300142525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/1636005121300142525'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/05/setcookie-tutorial-syntax-login-example.html' title='setcookie tutorial syntax login example'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-3046761496447380559</id><published>2009-04-29T03:27:00.001-07:00</published><updated>2009-04-29T03:28:27.603-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>regular expression tutorial basic rules beginners</title><content type='html'>I am also new to regular expressions and I am learning to some basic regular expression rules so I am trying to put them here in new post. Please put your comments if I am doing some mistake while explaining.&lt;br /&gt;&lt;br /&gt;There are some &lt;u&gt;special characters&lt;/u&gt; which are used while &lt;b&gt;developing the regular expression&lt;/b&gt;.Here are some ..&lt;br /&gt;&lt;b&gt;Modifiers&lt;/b&gt;&lt;br /&gt;Modifiers are used to alters the meaning of the immediately preceding pattern character.&lt;br /&gt;&lt;br /&gt;+   : &lt;u&gt;matches 1 or more&lt;/u&gt; of the preceding term&lt;br /&gt;      a* matches a,aa,aaa n so on&lt;br /&gt;-----------------------------------------------------------------------------&lt;br /&gt;*   : &lt;u&gt;matches 0 or more&lt;/u&gt; of the preceding term&lt;br /&gt;      a* matches '',a,aa,aaa n so on  &lt;br /&gt;-----------------------------------------------------------------------------&lt;br /&gt;?   : &lt;u&gt;matches 0 or 1&lt;/u&gt; of the preceding term&lt;br /&gt;      a* matches '' n  a -----------------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;Literal Characters&lt;/b&gt;&lt;br /&gt;.   : Matches any character including new line.Its called as wildcard.&lt;br /&gt;      Example 'a.c' will match 'aec', 'acc', 'a@a' and so on&lt;br /&gt;-----------------------------------------------------------------------------&lt;br /&gt;[   : Set of characters enclosed in [] matches any of the character included in set.&lt;br /&gt;      e.g.REGEX [abc] matches with a or b or c&lt;br /&gt;      &lt;b&gt;Inclusive Range[a-d]&lt;/b&gt;:matches any characters included in range of a - d.&lt;br /&gt;-----------------------------------------------------------------------------&lt;br /&gt;^   : &lt;b&gt;exclusion range[^a-d]&lt;/b&gt;:matches the characters not included in range a-d. &lt;br /&gt;      The caret loses its special meaning if it is not the first character of the &lt;br /&gt;      set. &lt;br /&gt;&lt;br /&gt;     It marks as start of line so regex "^start" will match any string that starts with "start".&lt;br /&gt;-----------------------------------------------------------------------------&lt;br /&gt;$   : It marks as end of line so regex "end$" will match any string that ends with "end".&lt;br /&gt;-----------------------------------------------------------------------------&lt;br /&gt;()| : Used for grouping of regular expressions.&lt;br /&gt;      (REGX1 | REGX2) will match for either REGX1 or REGX2.&lt;br /&gt;-----------------------------------------------------------------------------&lt;br /&gt;{   : Lets take an example : {1,2} matches between 1 and 2 occurrences of the &lt;br /&gt;      preceding term. 't{1,3}' will match 't', 'tt' and 'ttt' only.&lt;br /&gt;      Whereas&lt;br /&gt;      't{2}' will match 'tt' only.    &lt;br /&gt;-----------------------------------------------------------------------------&lt;br /&gt;\   : to escape the special character. &lt;br /&gt;-----------------------------------------------------------------------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-3046761496447380559?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/3046761496447380559/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/04/regular-expression-tutorial-basic-rules.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/3046761496447380559'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/3046761496447380559'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/04/regular-expression-tutorial-basic-rules.html' title='regular expression tutorial basic rules beginners'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-4570032543333623803</id><published>2009-04-24T00:30:00.001-07:00</published><updated>2009-05-04T04:04:38.590-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Z-PHP5-cert'/><category scheme='http://www.blogger.com/atom/ns#' term='oops'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='php tips'/><title type='text'>oops things to remember about class methods and everything</title><content type='html'>Hi all , this post is just to highlight some &lt;b&gt;important facts of oops n php&lt;/b&gt;. I am trying to categories them like class / interface / basic etc. Please put your comments if you want to suggest any category. Lets start..&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Class&lt;/b&gt;&lt;br /&gt;1. When a class defined as final it can no longer extended by other classes and function defined as final then it cant be overridden in child classes.&lt;br /&gt;&lt;br /&gt;2. A &lt;b&gt;abstract class cannot be instantiated&lt;/b&gt; and &lt;b&gt;it can only be extended&lt;/b&gt;. &lt;br /&gt;&lt;br /&gt;3. &lt;b&gt;Class constants are public&lt;/b&gt;, and accessible from &lt;b&gt;all scopes&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;4. &lt;b&gt;class can only extend one parent class&lt;/b&gt;, but it &lt;u&gt;can implement multiple&lt;br /&gt;interfaces&lt;/u&gt;.&lt;br /&gt;&lt;br /&gt;5. In php5 class objects are always passed as reference rather than a value.&lt;br /&gt;&lt;br /&gt;6. destructors are introduced in php5 but we cant determine the order of destroying of two different objects in our script.&lt;br /&gt;&lt;br /&gt;7. 4 access specifiers are introduced public,private,protected,final.&lt;br /&gt;&lt;br /&gt;8. the final specifier can be used for only classes and functions. If class is defined as final then it cant be extended.&lt;br /&gt;&lt;br /&gt;9. Member variable can be initialized at the time of declaration. &lt;br /&gt;&lt;br /&gt;10. Access to static property of class through the object will produce an notice. where as in php4 it was completely acceptable. &lt;a href="http://codepad.org/RieybUFv" target="_blank"&gt;Check sample code&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;11. Class constants are public, and accessible from all scopes.&lt;br /&gt;&lt;br /&gt;12. We can implement more than one interfaces in one class.&lt;br /&gt;&lt;br /&gt;13. Exceptions are the objects created whenever there is any error in script.&lt;br /&gt;__________________________________________________________________________&lt;br /&gt;&lt;b&gt;Methods&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;__________________________________________________________________________&lt;br /&gt;&lt;b&gt;Interface&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;__________________________________________________________________________&lt;br /&gt;&lt;b&gt;access specifiers&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;__________________________________________________________________________&lt;br /&gt;&lt;b&gt;exception handling&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;__________________________________________________________________________&lt;br /&gt;&lt;b&gt;keywords&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;__________________________________________________________________________&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-4570032543333623803?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/4570032543333623803/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/04/oops-things-to-remember-about-class.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/4570032543333623803'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/4570032543333623803'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/04/oops-things-to-remember-about-class.html' title='oops things to remember about class methods and everything'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-3973902149969392824</id><published>2009-04-23T23:55:00.000-07:00</published><updated>2009-04-24T00:07:07.239-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php functions'/><category scheme='http://www.blogger.com/atom/ns#' term='Z-PHP5-cert'/><category scheme='http://www.blogger.com/atom/ns#' term='oops'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>type hinting - objects as function parameter in php5.1</title><content type='html'>PHP5.1 came up with the &lt;b&gt;type hinting&lt;/b&gt;. We can pass the object of any class as function parameter. We just need to write it in the function  signature and its done.&lt;br /&gt;&lt;br /&gt;We can also pass &lt;b&gt;any array&lt;/b&gt; or &lt;b&gt;interface type&lt;/b&gt;. Other types such as string, int are not supported in PHP 5.1.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Sample code&lt;/b&gt;&lt;br /&gt;[code]&lt;br /&gt;class a&lt;br /&gt;{&lt;br /&gt;   public function __construct(b $b)&lt;br /&gt;   {&lt;br /&gt;     echo $b-&gt;v;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;class b&lt;br /&gt;{&lt;br /&gt;  public $v;&lt;br /&gt;  function __construct($val)&lt;br /&gt;  {&lt;br /&gt;    $this-&gt;v = $val;&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;$objb = new b('PHP is best');&lt;br /&gt;$obj = new a($objb);&lt;br /&gt;[code]&lt;br /&gt;&lt;a href="http://codepad.org/GqOe7M4v" target="_blank"&gt;&lt;h3&gt;php Type hinting sample code&lt;/h3&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color:red;background:yellow;"&gt;&lt;br /&gt;[php4 vs php5] : type hinting is introduced in php5.1&lt;br /&gt;[zce-5] : type hinting only with arrays and class objects.Not with strings and int.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-3973902149969392824?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/3973902149969392824/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/04/type-hinting-objects-as-function.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/3973902149969392824'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/3973902149969392824'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/04/type-hinting-objects-as-function.html' title='type hinting - objects as function parameter in php5.1'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-723154824862955992</id><published>2009-04-20T06:27:00.000-07:00</published><updated>2009-05-04T04:46:19.129-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Z-PHP5-cert'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='php tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Errors in php'/><title type='text'>custom error handler sample example script</title><content type='html'>Error handling in php?? do I really need to put my time on this or php does it automatically?? &lt;br /&gt;&lt;br /&gt;Errors are the part of every programming language and normally programmers don't want to pay much attention to handling the errors. PHP of course handle the errors and maintain logs also, but we should handle all the errors. PHP has very easy and better facility to &lt;b&gt;create custom error handling system&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Lets first see what type of errors are there in php&lt;/b&gt;&lt;br /&gt;1. Parse Errors             - compiler error&lt;br /&gt;2. Fatal Errors             - execution halts&lt;br /&gt;3. Warnings                 - execution continues&lt;br /&gt;4. Notices                  - execution continues&lt;br /&gt;&lt;br /&gt;&lt;b&gt;php.ini directives to control errors&lt;/b&gt;&lt;br /&gt;There are 3 important directives in php.ini.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;display_errors&lt;/b&gt;   keep it off always on production server.&lt;br /&gt;&lt;b&gt;log_errors&lt;/b&gt;       keep it on will log errors in server's logs&lt;br /&gt;&lt;b&gt;error_reporting&lt;/b&gt;  error reporting level setting can be done e.g. E_ALL~E_NOTICE&lt;br /&gt;&lt;br /&gt;&lt;b&gt;sample code to create a custom error handler in php&lt;/b&gt;&lt;br /&gt;[code]&lt;?php&lt;br /&gt;ini_set('display_errors', 'Off');&lt;br /&gt;ini_set('log_errors', 'On');&lt;br /&gt;&lt;br /&gt;function UserErrorHandler($errno, $errstr, $errfile, $errline)&lt;br /&gt;{&lt;br /&gt;    switch ($errno) {&lt;br /&gt;&lt;br /&gt;    case E_USER_WARNING:&lt;br /&gt;        echo "USER WARNING : [$errno] $errstr\n";&lt;br /&gt;        break;&lt;br /&gt;&lt;br /&gt;    case E_USER_NOTICE:&lt;br /&gt;        echo "USER NOTICE : [$errno] $errstr\n";&lt;br /&gt;        break;&lt;br /&gt;&lt;br /&gt;    case E_USER_ERROR:&lt;br /&gt;        echo "USER ERROR : [$errno] $errstr\n";&lt;br /&gt;        echo "There is a fatal error on line no $errline in script $errfile\n";&lt;br /&gt;        echo PHP_VERSION . " on  (" . PHP_OS . ")\n";&lt;br /&gt;        echo "Execution ends\n";&lt;br /&gt;        exit();&lt;br /&gt;        break;&lt;br /&gt;&lt;br /&gt;    default:&lt;br /&gt;        echo "Unknown error types: [$errno] $errstr\n";&lt;br /&gt;        break;&lt;br /&gt;    }&lt;br /&gt;    /* you can send email to admin or any other logging system */&lt;br /&gt;    return true;&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;set_error_handler("UserErrorHandler",E_ALL);&lt;br /&gt;&lt;br /&gt;$x=0;&lt;br /&gt;$y=1;&lt;br /&gt;&lt;br /&gt;// division by 0 error &lt;br /&gt;echo $y/$x;&lt;br /&gt;echo "\n\n";&lt;br /&gt;&lt;br /&gt;// lets c user generated error&lt;br /&gt;if(0===$x)&lt;br /&gt;trigger_error('X cant be 0',E_USER_ERROR);&lt;br /&gt;&lt;br /&gt;?&gt;[code]&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;a href="http://codepad.org/z4PV3VwI" title="view sample custom error handler code and output" target="_blank"&gt;Sample custom error handler code&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;If you look at above &lt;u&gt;sample error handler function &lt;/u&gt;, you can understand that the function which is used to  create a custom error handler is &lt;b&gt;set_error_handler()&lt;/b&gt;. In php5 it starts accepting 2 parameters error handler function name and error type which are handled by that function. In older versions of php this function was accepting only one parameter.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Error handling function&lt;/b&gt; : UserErrorHandler is our custom error handling function. This function will get executed whenever there is any error in code. Then its upto you how to handle the errors, you can mail them to administrator or you can keep them in some file log or display it to users.complete freedom to manage the errors in system. This function takes 5 parameters as follows&lt;br /&gt;&lt;br /&gt;&lt;b&gt;error_level&lt;/b&gt;     :  e.g. E_ALL , E_NOTICE ..&lt;br /&gt;&lt;b&gt;error_message&lt;/b&gt;   : error message&lt;br /&gt;&lt;b&gt;error_file&lt;/b&gt;      : file name in which the error occurred&lt;br /&gt;&lt;b&gt;error_line&lt;/b&gt;      : line no in which the error occurred&lt;br /&gt;&lt;b&gt;error_context&lt;/b&gt;   : array of variables in that error context&lt;br /&gt;&lt;br /&gt;-- oops way of handling errors is different. We can implement the custom error handler in php with help of php5 default class Exception. &lt;a href="http://codepad.org/4MjNDWcW" title="Sample php5 custom error handler code" target="_blank"&gt;Sample php5 custom error handler code&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;We can also set a exception handler for complete application. I mean a function which can handle all the uncaught exceptions. Just look at following code.&lt;br /&gt;&lt;?php&lt;br /&gt;// how to handle error any where in application &lt;br /&gt;function uncaughtexception(Exception $e)&lt;br /&gt;{&lt;br /&gt;  echo $e-&gt;getMessage()."\n";&lt;br /&gt;  echo $e-&gt;getCode()."\n";  &lt;br /&gt;  echo $e-&gt;getLine();&lt;br /&gt;}&lt;br /&gt;set_exception_handler('uncaughtexception');&lt;br /&gt;&lt;br /&gt;throw new exception('u caught me');&lt;br /&gt;&lt;br /&gt;//output&lt;br /&gt;u caught me&lt;br /&gt;0&lt;br /&gt;11&lt;br /&gt;?&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;div style="background:yellow:color:red;"&gt;&lt;br /&gt;[php4 vs php5]: In php5 set_error_handler() supports second parameter to set the type of error that custom error handler function is going to handle. &lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-723154824862955992?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/723154824862955992/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/04/custom-error-handler-sample-example.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/723154824862955992'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/723154824862955992'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/04/custom-error-handler-sample-example.html' title='custom error handler sample example script'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-6022816997578121032</id><published>2009-04-16T04:32:00.000-07:00</published><updated>2009-04-16T05:43:26.923-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Z-PHP5-cert'/><category scheme='http://www.blogger.com/atom/ns#' term='design pattern'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>design patterns singleton factory adapter Active records proxy mvc Registry</title><content type='html'>Design patterns are the solutions to day to day programming problems. PHP5 has good support for object oriented programming approch. Design patterns are standard class designing techniques.&lt;br /&gt;&lt;br /&gt;There are lots of design patterns but only few are accepted and become standard design patterns. I am also beginner with design patterns and I found it very very useful while working on bog oops based projects.&lt;br /&gt;&lt;br /&gt;Here are some standard design patterns.&lt;br /&gt;1.Adapter pattern&lt;br /&gt;2.Factory pattern&lt;br /&gt;3.Singleton pattern&lt;br /&gt;4.Active Record&lt;br /&gt;5.Row data gateway pattern&lt;br /&gt;6.Registry pattern&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;&lt;b&gt;1.Adapter pattern&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;I have some class libraries which I need in almost all projects to achive common tasks like authentication , database connections etc. I normally include all those classes and the rest application script make use of those classes by instantiating class objects. This technique looks fine in any case. But at some instance I need to have some more functionally to be carried out by one of old the classes, And I cant change the class files directly. This issue can be solved by &lt;u&gt;adapter design pattern&lt;/u&gt;.Adapter class is nothing but a simple class which adapts the methods of base class and simply use them to carry out new functionality.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;&lt;b&gt;When to use adapter design pattern?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Now suppose I have one class library with some basic methods and after some days I need to use that class but existing functions in that class are not sufficient for new task. Now the main problem is I can't chage the existing class. What can be done in this case? solution is &lt;u&gt;adapter class implementation&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;&lt;b&gt;How adapter class works?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Now I will &lt;u&gt;create an adapter class&lt;/u&gt; which will make use of the methods of existing class and adapt them in to a new method that I need in new project.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;&lt;b&gt;done&lt;/b&gt;&lt;/span&gt; &lt;a title="sample code for adapter design pattern implementation" href="http://codepad.org/SFJDFM4k"&gt;sample code&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;&lt;b&gt;How to identify the adapter pattern&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;When &lt;b&gt;constructor of a class takes object of another class&lt;/b&gt; and one of the method of new class adapt the methods of the object passed in constructor then it is a &lt;u&gt;adapter class&lt;/u&gt;.&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;&lt;b&gt;2. factory pattern&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;I have a generic class to connect to database server and select the database. I normally use this class to handle my database connections. But I can have different database servers in different projects like MySQL,microsoft SQL server,oracle etc.... In this case I can have a factory method in my generic class which gives fecility to create an instance of one or more other classes ( In my case these clases are classes for different databases.) &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;&lt;b&gt;How to identify&lt;/b&gt;&lt;/span&gt; &lt;br /&gt;When there is any static function in class which instantiate other objects depend on some condition then it can be a &lt;u&gt;factory method implementation&lt;/u&gt;.&lt;br /&gt;&lt;br /&gt;&lt;a title="sample code for factory method pattern implementation" href="http://codepad.org/rYTmx9Ij"&gt;sample code for factory method&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;-------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;&lt;b&gt;3. singleton pattern&lt;/b&gt;&lt;/span&gt; &lt;br /&gt;This is the most simplest design pattern. This pattern is used in application when we dont want the duplication of access to some resource. In simple words only one instance of class can be created, and only one instance is used in whole application. Mostly this kind of implementation is used for database connections, to have only one database connection at a time.&lt;br /&gt;&lt;br /&gt;&lt;a title="sample code for singleton design pattern implementation" href="http://codepad.org/ko3HRiZF"&gt;sample code for singleton pattern&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;-------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;&lt;b&gt;4. Active Record&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Very complex to implement. This kind of class are used for database applications. Active record and row data gateway are similler. Only difference is Active record pattern contains some domain logic to process the data.&lt;br /&gt;&lt;br /&gt;-------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;&lt;b&gt;5. Row data gateway pattern&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Very complex to implement. This kind of class are used for database applications.&lt;br /&gt;A class that represents one row in database table implements row data gateway pattern.&lt;br /&gt;&lt;br /&gt;-------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;&lt;b&gt;6. Registry pattern&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Registry pattern is extension of singleton pattern. It allows us to use any object as a singleton object without writing its class in singleton way.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-6022816997578121032?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/6022816997578121032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/04/design-patterns-singleton-factory.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/6022816997578121032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/6022816997578121032'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/04/design-patterns-singleton-factory.html' title='design patterns singleton factory adapter Active records proxy mvc Registry'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-5811084669076452061</id><published>2009-04-14T04:33:00.000-07:00</published><updated>2009-04-14T06:51:57.492-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='magic functions'/><category scheme='http://www.blogger.com/atom/ns#' term='php functions'/><category scheme='http://www.blogger.com/atom/ns#' term='Z-PHP5-cert'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='php tips'/><title type='text'>Member overloading magic function set() get isset unset</title><content type='html'>OOPS in PHP  supports overloading of &lt;b&gt;member variables&lt;/b&gt; and &lt;b&gt;member functions&lt;/b&gt;. Overloading means we can have &lt;b&gt;dynamic member variables&lt;/b&gt; and or &lt;b&gt;member functions&lt;/b&gt;. PHP has set of magic functions which can be used to have dynamic variables for class and also dynamic functions. Lets see this with help of sample code.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Creating dynamic member&lt;/b&gt;  &lt;br /&gt;__set() and __get() methods can be used while creating dynamic member variables.&lt;br /&gt;&lt;b&gt;__set()&lt;/b&gt; magic method get called when we are trying to assign value to non existence member variable. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;__get()&lt;/b&gt; magic method get called when we are trying to access the non existence member variable.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://codepad.org/tUo9MCKK" title="sample code of__set() and __get()"&gt;Sample code __set() and __get()&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color:red;background:yellow;"&gt;&lt;br /&gt; [zce-5]Arguments to the magic methods (overloading) cant have arguments pass by reference.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-5811084669076452061?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/5811084669076452061/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/04/member-overloading-magic-function-set.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/5811084669076452061'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/5811084669076452061'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/04/member-overloading-magic-function-set.html' title='Member overloading magic function set() get isset unset'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-6179039721307965449</id><published>2009-04-13T06:34:00.000-07:00</published><updated>2009-04-15T00:42:53.300-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='magic functions'/><category scheme='http://www.blogger.com/atom/ns#' term='php functions'/><category scheme='http://www.blogger.com/atom/ns#' term='Z-PHP5-cert'/><category scheme='http://www.blogger.com/atom/ns#' term='php tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Errors in php'/><title type='text'>magic methods __sleep __wakeup __autoload __get __set __isset __unset __construct __destruct</title><content type='html'>PHP has a set of functions starts with __. These all functions are called as &lt;b&gt;magic functions / magic methods&lt;/b&gt;. You should not create any function in your application with name starts from __ as __ is reserved for php magic functions and in later versions there is possibility of conflict.  &lt;br /&gt;&lt;br /&gt;Here is a list of some &lt;u&gt;magic functions&lt;/u&gt;&lt;br /&gt;&lt;b&gt;1.__sleep()&lt;/b&gt; : get called automatically before serialization of object.&lt;a href="http://codepad.org/F6eSp0s0" target="_blank" title="sample code for php magic function __sleep()"&gt;sample code __sleep&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2.__wakeup() :&lt;/b&gt; get called automatically after un-serialization of object. Use to define the post-un-serialization action of class object. &lt;a href="http://codepad.org/F6eSp0s0" target="_blank" title="sample code for php magic function __wakeup"&gt;sample code __wakeup&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;3.__construct()&lt;/b&gt; Function which gets called automatically when instance of class gets created. &lt;a href="http://codepad.org/2MFm6lHr" taret="_blank" title="sample use of magic function __construct()"&gt;Sample code for __construct&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;&lt;b&gt;4.__destruct()&lt;/b&gt; Function which gets called automatically when all references to particular object are removed. &lt;a href="http://codepad.org/2MFm6lHr" taret="_blank" title="sample use of magic function __construct()"&gt;Sample code for __construct&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;5.__clone()&lt;/b&gt; Simply clone the object. This function gets executed automatically when clone of object is created, and code written in this function will work on properties of cloned object only. we can say that this function is used to decide the &lt;b&gt;post cloning operations&lt;/b&gt;. &lt;a href="http://codepad.org/Y1CRTeHC" target="_blank" title="sample use of magic function __clone."&gt;sample code __clone()&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;6.__get()&lt;/b&gt; is executed when we try to get the value from non-existing member variable. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;7.__set()&lt;/b&gt; is executed when we try to assign value to non-existing member variable. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;8.__isset()&lt;/b&gt;is executed when we try to execute isset() function  on any non-existing member variable. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;9.__unset()&lt;/b&gt;is executed when we try to execute unset() function  on any non-existing member variable. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;10.__call()&lt;/b&gt;is executed when we try to execute any non-existing member function. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;11.__callStatic()&lt;/b&gt;is executed when we try to execute any non-existing member function in static scope.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;12.__autoload()&lt;/b&gt;is executed when we try to create an instance of non-existing class. We can simply write a code in this function to include the respected class. This helps us to load the classes when they really needed.Very big feature of php.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;13.&lt;/b&gt;__toString() This function get invoked when you try to convert the class object to string. &lt;a href="http://codepad.org/qkfe4XlH" target="_blank" title="sample code for use of __toString()"&gt;How to use __toString()&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;&lt;b&gt;14.&lt;/b&gt;__invoke() php5.3.0 only This function get invoked when you are trying to use the object of class like a function call. e.g. - $objOfClass('some arguments'); &lt;br /&gt;&lt;br /&gt;&lt;b&gt;15.&lt;/b&gt;static __set_state(array) This function get executed when we try to export class object with var_export().&lt;br /&gt;&lt;br /&gt;&lt;div style="background:yellow;color:red"&gt;&lt;br /&gt;[zce-5] : parent class constructor can be called with &lt;b&gt;"parent::__construct();"&lt;/b&gt;&lt;br /&gt;[zce-5] : __clone() is called by keyword clone. &lt;br /&gt;[zce-5] : Arguments to the magic methods (overloading) cant have arguments pass by reference.&lt;br /&gt;[php4 vs php5] : __construct() magic function is in php 5 and in php4 we have to crate constructor by conventional way. &lt;br /&gt;[php4 vs php5] : destructors are not there in php4. In php5 we can create function __destruct() &lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-6179039721307965449?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/6179039721307965449/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/04/magic-methods-sleep-wakeup-autoload-get.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/6179039721307965449'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/6179039721307965449'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/04/magic-methods-sleep-wakeup-autoload-get.html' title='magic methods __sleep __wakeup __autoload __get __set __isset __unset __construct __destruct'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-5514906008010922331</id><published>2009-04-13T06:20:00.000-07:00</published><updated>2009-04-13T06:31:16.078-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Z-PHP5-cert'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>magic constants __FILE__LINE__DIR__FUNCTION__CLASS__METHOD__NAMESPACE__</title><content type='html'>php provides &lt;b&gt;7 magic constants&lt;/b&gt;. These are assigned to any php script by different php extensions.&lt;br /&gt;&lt;br /&gt;__DIR__     : directory of file&lt;br /&gt;__FILE__    : current file name&lt;br /&gt;__LINE__    : current line no of file&lt;br /&gt;&lt;br /&gt;__FUNCTION__  : function name (php4.3.0)&lt;br /&gt;__CLASS__     : class name    (php4.3.0)&lt;br /&gt;__METHOD__    : class method  (php 5.0.0)&lt;br /&gt;&lt;br /&gt;__NAMESPACE__ : name of current namespace (php5.3.0)&lt;br /&gt;&lt;br/&gt;&lt;br/&gt;&lt;br /&gt;&lt;div style="color:red;background:yellow;"&gt;&lt;br /&gt;[php4 vs php5] - new magic constants added (NAMESPACE,METHOD)&lt;br /&gt;[php4 vs php5] - (__FUNCTION__,__CLASS__,__METHOD__) returns &lt;b&gt;case-sensitive name in php 5&lt;/b&gt; where as in &lt;b&gt;php4 it returns in lowercase&lt;/b&gt;.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-5514906008010922331?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/5514906008010922331/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/04/magic-constants-filelinedirfunctionclas.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/5514906008010922331'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/5514906008010922331'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/04/magic-constants-filelinedirfunctionclas.html' title='magic constants __FILE__LINE__DIR__FUNCTION__CLASS__METHOD__NAMESPACE__'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-1343844935764479318</id><published>2009-04-13T01:55:00.000-07:00</published><updated>2009-05-11T23:56:22.691-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php functions'/><category scheme='http://www.blogger.com/atom/ns#' term='Z-PHP5-cert'/><title type='text'>php functions in details tricks n tips</title><content type='html'>I am working with php since more than 3 years and I love this language as this is very powerful servers side programming language. Actually I like the set of php built in functions. Php really has a lots of built in functions for arrays and string manipulation and almost for everything. Here I am trying to write some important things about the &lt;b&gt;php functions&lt;/b&gt; and some important tips specially for the peoples who are preparing for some certifications or some php exam.&lt;br /&gt;&lt;br /&gt;PHP has&lt;br /&gt;1.User-Defined functions&lt;br /&gt;2.Variable functions&lt;br /&gt;3.Anonymous functions &lt;a href="http://in.php.net/manual/en/functions.anonymous.php" terget="_blank" title="sample code Anonymous functions"&gt;Only php5.3.0 &gt;&lt;/a&gt;&lt;br /&gt;-----------------------------------------------------&lt;br /&gt;&lt;b&gt;1.User-Defined functions&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;function function_name(mixed arg1,.....,mixed argn)&lt;br /&gt;{&lt;br /&gt;  // any valid php script&lt;br /&gt;} &lt;br /&gt;&lt;b&gt;Passing arguments to function&lt;/b&gt;&lt;br /&gt;&lt;u&gt;a)Default method to pass arguments is pass by value&lt;/u&gt;&lt;br /&gt;   function takes_array($input)&lt;br /&gt;&lt;br /&gt;&lt;u&gt;b)Another method is pass by reference&lt;/u&gt;&lt;br /&gt;   function takes_array(&amp;$input)&lt;br /&gt;&lt;br /&gt;&lt;u&gt;c)default argument values.&lt;/u&gt;&lt;br /&gt;  In this we can give the default value to the trailing function arguments.&lt;br /&gt;  function function_name($arg1,$arglast = "defaultvalue")&lt;br /&gt;&lt;br /&gt;&lt;u&gt;d)variable length argument list&lt;/u&gt;&lt;br /&gt;  We can simply define the function without any argument to it and we can call it and pass random no of arguments at different time. we have to use some built-in functions to implement such kind of function. &lt;a href="http://codepad.org/X9TAeiIR" target="_blank" title="sample code for use of variable length argument list"&gt;sample code snippet- thank to codepad.org&lt;/a&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-----------------------------------------------------&lt;br /&gt;&lt;b&gt;2.Variable functions&lt;/b&gt;&lt;br /&gt;We can simply put the function name in a variable and can execute that function by $varname('function argument if any');&lt;br /&gt;&lt;a href="http://codepad.org/I5txkKPg" title="sample code for variable functions in php" target="_blank"&gt;sample code for variable function&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br/&gt;&lt;br/&gt;&lt;br /&gt;&lt;div style="color:red;background:yellow"&gt;&lt;br /&gt;[php4 vs php5] -  In php5 default values may be passed by reference.&lt;br /&gt;&lt;br /&gt;[zce-5]func_get_args() and func_get_arg() works for only arguments which are passed to function and not for the default arguments.&lt;br /&gt;&lt;br /&gt;A function can not return multiple values.&lt;br /&gt;&lt;br /&gt;To return a reference from a function, use the reference operator &amp; in both the function declaration and when assigning the returned value to a variable.&lt;br /&gt;&lt;br /&gt;[zce-5]language constructs : echo(), print(), isset(), unset(), empty(), include(), require(),array(),list(),die(),exit(),eval(), return cant be used with variable functions.   &lt;br /&gt;&lt;br /&gt;[zce-5] : php functions are not case sensitive.&lt;br /&gt;&lt;br /&gt;[php4 vs php5]Anonymous functions are not there in php4.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-1343844935764479318?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/1343844935764479318/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/04/php-functions-in-details-tricks-n-tips.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/1343844935764479318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/1343844935764479318'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/04/php-functions-in-details-tricks-n-tips.html' title='php functions in details tricks n tips'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-5364546732226145789</id><published>2009-04-10T04:44:00.000-07:00</published><updated>2009-04-10T05:27:44.975-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Z-PHP5-cert'/><category scheme='http://www.blogger.com/atom/ns#' term='q'/><title type='text'>tricky questions php tips and twicks very important for some php exams.</title><content type='html'>&lt;?php&lt;br /&gt;$x = "08";&lt;br /&gt;$y = 08;&lt;br /&gt;$z = " 47";&lt;br /&gt;&lt;br /&gt;$x +=15;&lt;br /&gt;$y +="15";&lt;br /&gt;$z +=11;&lt;br /&gt;&lt;br /&gt;echo $x;&lt;br /&gt;echo $y;&lt;br /&gt;echo $z;&lt;br /&gt;&lt;br /&gt;// output&lt;br /&gt;231558&lt;br /&gt;----------------------&lt;br /&gt;&lt;br /&gt;How do you swap two integer values from two variables without using another variable?&lt;br /&gt;&lt;br /&gt;a = a + b;&lt;br /&gt;b= a - b ;&lt;br /&gt;a = a - b ;&lt;br /&gt;?&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-5364546732226145789?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/5364546732226145789/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/04/tricky-questions-php-tips-and-twicks.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/5364546732226145789'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/5364546732226145789'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/04/tricky-questions-php-tips-and-twicks.html' title='tricky questions php tips and twicks very important for some php exams.'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-4849551208433442479</id><published>2009-04-09T02:58:00.000-07:00</published><updated>2009-05-08T03:44:59.277-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Z-PHP5-cert'/><category scheme='http://www.blogger.com/atom/ns#' term='website security'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>developing secured web application with php</title><content type='html'>Security of a web application&lt;br /&gt;&lt;br /&gt;When there is a user interaction in web page and the input data is coming from user inputs and query string etc etc... then I cant trust the behavior of the web page! can you?????&lt;br /&gt;&lt;br /&gt;Users can enter the script or some other special characters in query string which can result in to unpredictable behavior...!&lt;br /&gt;&lt;br /&gt;some simple things which we should use while developing the application.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;1.Input filters&lt;/span&gt; &lt;/b&gt;   &lt;a href="http://php-tuts.blogspot.com/2009/04/filtering-types-validation-n.html" title="click to view more about input filters."&gt;more&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;2.Escape Output&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;Always use the htmlentities() function to echo the variables.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;&lt;b&gt;3. Register Globals&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;When set to &lt;b&gt;On, the register_globals&lt;/b&gt; configuration directive automatically injects variables into scripts. That is, all variables from the query string, posted forms, session store, cookies, and so on are available in what appear to be locally-named variables.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Status of register_globals configuration directive&lt;/b&gt;&lt;br /&gt;&lt;u&gt;Before 4.2.0&lt;/u&gt; it was &lt;u&gt;on&lt;/u&gt; by default.&lt;br /&gt;&lt;u&gt;Since&lt;/u&gt; then it is set as &lt;u&gt;off&lt;/u&gt; as default.&lt;br /&gt;In &lt;u&gt;php 6&lt;/u&gt; it will be &lt;u&gt;deprecated&lt;/u&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;&lt;b&gt;4.spoof form&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Attacker normally go for spoofed form submission. e.g. attacker can simply copy the form to there own local machine change the action with full page url and this way they can change the client side validations and other restrictions.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How to overcome form spoof attacks?&lt;/b&gt;&lt;br /&gt;STOPING OFF DOMAIN TRANSACTIONS&lt;br /&gt;Check the REFERER header in $_SERVER superglobal array. The referer has to be your site only.&lt;br /&gt;&lt;br /&gt;sample snippet&lt;br /&gt;if (stristr($_SERVER['HTTP_REFERER'], 'http://www.supamu.info') === FALSE ) {&lt;br /&gt;   die ( 'Hacking attempt. Your are such a Nooby!.. ' );&lt;br /&gt;** &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;&lt;b&gt;5.Cross-Site Scripting (XSS)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Its all about stealing the users personal data and values from cookies with the help of some simple JavaScript techniques.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How to overcome form Cross-Site Scripting (XSS) attacks?&lt;/b&gt;&lt;br /&gt;Proper output escaping is the only way to make your web pages secure from such attacks.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;&lt;b&gt;6.Database Security - SQL injection attack&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;We normally asks users to fill some data in form elements and we use these user entered data in one of the queries.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How to avoid sql injection attacks?&lt;/b&gt;&lt;br /&gt;&lt;b&gt;1. Use the input filters to filter the user data.&lt;/b&gt;&lt;br /&gt;Whenever there is a data from outside world just use the php input filters and&lt;br /&gt;sanitize input data, before being used in a sql query.&lt;br /&gt;&lt;a href="http://php-tuts.blogspot.com/2009/04/filtering-types-validation-n.html" title="more about the php input filter extension"&gt;How to filter the inputs.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2. Always escape your input&lt;/b&gt;&lt;br /&gt;&lt;a href="http://www.blogger.com/post-edit.g?blogID=2063777811819971705&amp;amp;postID=4849551208433442479#"&gt;PHP&lt;/a&gt; has certain built in function which can be used to make database queries safe from outside world.&lt;br /&gt;&lt;b&gt;mysql_escape_string&lt;/b&gt;  and &lt;b&gt;mysql_real_escape_string&lt;/b&gt;.&lt;br /&gt;Mysql_real_escape_string prepends backslashes to the following characters: \x00, \n, \r, \, ', " and \x1a.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://shiflett.org/blog/2006/jan/addslashes-versus-mysql-real-escape-string" target="_blank" title="Very good article on web security"&gt;Very good article on web security&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;&lt;b&gt;Are you on shared hosting??&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;There are variety of security issues while using shared hosting. I cant write much theory here so I am just writing some important things that you should do on shard hosting.&lt;br /&gt;There are 3 very important directives in php configuration file (php.ini)&lt;br /&gt;&lt;u&gt;&lt;b&gt;Disable_functions&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;This directive in php.ini allows us to disable some functions. We should normally specify the fnctions which are related to security of server. Some of them are &lt;br /&gt;exec,apache_setenv,disk_free_space,diskfreespace,dl,&lt;br /&gt;                    highlight_file,ini_alter,ini_restore,openlog,passthru,phpinfo,&lt;br /&gt;                    proc_nice,shell_exec,show_source,symlink,system&lt;br /&gt;&lt;br /&gt;---------------------------------------------------------------------------------&lt;br /&gt;&lt;u&gt;&lt;b&gt;open_basedir&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;---------------------------------------------------------------------------------&lt;br /&gt;&lt;u&gt;&lt;b&gt;disable_classes&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;Just open the php.ini file and search for these directives. I cant write description better than that.. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;&lt;b&gt;7.Disable Remote URLs&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1. &lt;u&gt;allow_url_fopen&lt;/u&gt; to off in php.ini.&lt;br /&gt;&lt;br /&gt;2. &lt;u&gt;open_basedir&lt;/u&gt; in php.ini to a set of directories that PHP is allowed to perform file operations on&lt;br /&gt;&lt;br /&gt;3. &lt;u&gt;safe_mode&lt;/u&gt; to on in php.ini. This will prevent the use of the system functions like system(), passthru() and exec(), but will also create other problems as well.&lt;br /&gt;&lt;br /&gt;4. Always Use the &lt;u&gt;file_exists() function&lt;/u&gt; (which does not work on remote files) to determine the existence of the file to be included on the local filesystem before including it. The safest way to include the files.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://technosailor.com/2005/02/02/lessons-in-web-security-php-and-remote-file-execution/" target="_blank" title="view original post from Aaron Brazell"&gt;Thanks to Aaron Brazell&lt;/a&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;Best of luck n have secured web applications. Please add your reviews in comments.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-4849551208433442479?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/4849551208433442479/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/04/developing-secured-web-application-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/4849551208433442479'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/4849551208433442479'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/04/developing-secured-web-application-with.html' title='developing secured web application with php'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-5523440395511843946</id><published>2009-04-09T02:13:00.000-07:00</published><updated>2009-04-09T02:55:51.527-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Z-PHP5-cert'/><category scheme='http://www.blogger.com/atom/ns#' term='website security'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>filtering types : validation n sanitization filter extension added in php5</title><content type='html'>&lt;b&gt;Filter extension is added in php version 5.2.0&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Settings in php.ini&lt;/b&gt;&lt;br /&gt;some settings are added in php.ini for managing the behavior of this extension.&lt;br /&gt;&lt;br /&gt;;filter.default = unsafe_raw&lt;br /&gt;;filter.default_flags =&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;We can do &lt;b&gt;input filtering&lt;/b&gt; by following two methods. &lt;br /&gt;&lt;b&gt;1. Validation&lt;/b&gt; - checks the data for all desired characters, and does not change the data.&lt;br /&gt;&lt;b&gt;2. sanitization&lt;/b&gt; - removes the undesired characters from data and give filtered data.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;1.validate filters&lt;/b&gt;&lt;br /&gt;  FILTER_VALIDATE_BOOLEAN&lt;br /&gt;  FILTER_VALIDATE_FLOAT&lt;br /&gt;  FILTER_VALIDATE_INT&lt;br /&gt;  FILTER_VALIDATE_IP&lt;br /&gt;  FILTER_VALIDATE_REGEXP&lt;br /&gt;  FILTER_VALIDATE_URL&lt;br /&gt;  FILTER_VALIDATE_EMAIL&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2.sanitization filters&lt;/b&gt;&lt;br /&gt;  FILTER_SANITIZE_EMAIL&lt;br /&gt;  FILTER_SANITIZE_ENCODED&lt;br /&gt;  FILTER_SANITIZE_MAGIC_QUOTES               --- apply addslashesh&lt;br /&gt;  FILTER_SANITIZE_NUMBER_FLOAT&lt;br /&gt;  FILTER_SANITIZE_NUMBER_INT&lt;br /&gt;  FILTER_SANITIZE_SPECIAL_CHARS&lt;br /&gt;  FILTER_SANITIZE_STRING&lt;br /&gt;  FILTER_SANITIZE_STRIPPED&lt;br /&gt;  FILTER_SANITIZE_URL&lt;br /&gt;  FILTER_UNSAFE_RAW&lt;br /&gt;&lt;br /&gt;&lt;b&gt;3. special filter - user filter&lt;/b&gt;&lt;br /&gt; FILTER_CALLBACK  - user can define a function to filter out the data.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-5523440395511843946?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/5523440395511843946/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/04/filtering-types-validation-n.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/5523440395511843946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/5523440395511843946'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/04/filtering-types-validation-n.html' title='filtering types : validation n sanitization filter extension added in php5'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-5584822106633420378</id><published>2009-04-08T02:27:00.000-07:00</published><updated>2009-04-09T00:35:23.042-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Z-PHP5-cert'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Ctype Functions 4 filter input get and post data filtering</title><content type='html'>&lt;b&gt;Security of a web application&lt;/b&gt; is very important because mostly dynamic web applications need user interaction and user inputs through php &lt;a href="http://php-tuts.blogspot.com/2009/04/superglobals-arrays-predefined.html" target="_blank" title="what is php superglobals?"&gt;superglobals&lt;/a&gt; ($_GET,$_POST etc..). So here is a need of applying the filter logic to the user inputs. There are two methods for input filtering but in this post I am writing for only &lt;b&gt;whitelist filtering technique.&lt;/b&gt; &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Character type checking-Whitelist filtering technique-(PHP 4 &gt;= 4.0.4, PHP 5)&lt;/b&gt;&lt;br /&gt;These set of functions check whether the string falls in to certain characters set or not. This character set can be defined by &lt;b&gt;setlocal()&lt;/b&gt; &lt;br /&gt;&lt;br /&gt;We can use &lt;u&gt;Whitelist filtering technique&lt;/u&gt; to filter the user inputs. PHP has some functions &lt;b&gt;(ctype functions)&lt;/b&gt; to achieve this kind of filtering technique. Take a look at following php functions....&lt;b&gt;There are 11 ctype functions&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;bool ctype_alpha($dataToFilter);&lt;/b&gt;&lt;br /&gt;    Check the variable for only characters.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;bool ctype_digit($dataToFilter);&lt;/b&gt;&lt;br /&gt;    Check the variable for numerics only.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;bool ctype_alnum($dataToFilter);&lt;/b&gt;&lt;br /&gt;    Check the variable for only alphanumeric data.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;bool ctype_cntrl($dataToFilter);&lt;/b&gt;&lt;br /&gt;    Check the variable for only the control characters. e.g.line feed,tab,escape..&lt;br /&gt;&lt;br /&gt;&lt;b&gt;bool ctype_graph($dataToFilter);&lt;/b&gt;&lt;br /&gt;    Check the variable for printable characters except space.It means it returns false if the variable contains any non visible characters like \n\t etc...&lt;br /&gt;&lt;br /&gt;&lt;b&gt;bool ctype_print($dataToFilter);&lt;/b&gt;&lt;br /&gt;    Check the variable for printable characters &lt;br /&gt;&lt;br /&gt;&lt;b&gt;bool ctype_lower($dataToFilter);&lt;/b&gt;&lt;br /&gt;    Check the variable for lowercase characters.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;bool ctype_upper($dataToFilter);&lt;/b&gt;&lt;br /&gt;    Check the variable for uppercase characters.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;bool ctype_punct($dataToFilter);&lt;/b&gt;&lt;br /&gt;    Returns TRUE if every character in text  is printable, but neither letter, digit or blank&lt;br /&gt;&lt;br /&gt;&lt;b&gt;bool ctype_space($dataToFilter);&lt;/b&gt;&lt;br /&gt;    Check if all the characters create white space? e.g.\n\r\t&lt;br /&gt;&lt;br /&gt;&lt;b&gt;bool ctype_xdigit($dataToFilter);&lt;/b&gt;&lt;br /&gt;    check for character representing hexadecimal digit.&lt;br /&gt;&lt;br /&gt;Will post more details on each function later.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-5584822106633420378?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/5584822106633420378/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/04/ctype-functions-4-filter-input-get-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/5584822106633420378'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/5584822106633420378'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/04/ctype-functions-4-filter-input-get-and.html' title='Ctype Functions 4 filter input get and post data filtering'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-1109485640532997342</id><published>2009-04-08T00:15:00.000-07:00</published><updated>2009-04-08T03:48:25.712-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Z-PHP5-cert'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Superglobals arrays predefined variables available in all scope</title><content type='html'>&lt;b&gt;php superglobals&lt;/b&gt; are some predefined variables / arrays which are available in &lt;b&gt;all scope&lt;/b&gt;. &lt;br /&gt;&lt;br /&gt;There are 9 superglobals in php. Here is a list..&lt;br /&gt;$GET&lt;br /&gt;$POST&lt;br /&gt;$_REQUEST&lt;br /&gt;$_FILES&lt;br /&gt;&lt;br /&gt;$_SESSION&lt;br /&gt;$_COOKIE&lt;br /&gt;&lt;br /&gt;$GLOBALS&lt;br /&gt;$_ENV&lt;br /&gt;$_SERVER&lt;br /&gt;&lt;br /&gt;I will write some more details about each superglobal array very sooon.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-1109485640532997342?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/1109485640532997342/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/04/superglobals-arrays-predefined.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/1109485640532997342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/1109485640532997342'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/04/superglobals-arrays-predefined.html' title='Superglobals arrays predefined variables available in all scope'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-3617348346703385794</id><published>2009-04-07T01:29:00.000-07:00</published><updated>2009-04-08T03:48:53.454-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php questions'/><category scheme='http://www.blogger.com/atom/ns#' term='Z-PHP5-cert'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>array functions and questions interview</title><content type='html'>Hey all I am trying to collect the different questions on php arrays. This collection can help the readers to prepare for some online exams or or some interviews. I am focusing to collect some &lt;b&gt;tough questions on php arrays&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;List of php Array Functions&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;array_change_key_case()&lt;/b&gt;&lt;br /&gt; -- Returns an array with all string keys lowercased or uppercased &lt;br /&gt;------------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;array_chunk()&lt;/b&gt; &lt;br /&gt; -- syntax &lt;br /&gt;    array array_chunk  ( array $input  , int $size  [, bool $preserve_keys= false ])&lt;br /&gt; -- Chunks an array into size  large chunks.&lt;br /&gt;------------------------------------------------------------------------ &lt;br /&gt;&lt;b&gt;array_combine()&lt;/b&gt;&lt;br /&gt; -- syntax&lt;br /&gt;    array array_combine  ( array $keys  , array $values  )&lt;br /&gt; -- Creates an array by using one array for keys and another for its values &lt;br /&gt;------------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;array_count_values()&lt;/b&gt;&lt;br /&gt; -- syntax&lt;br /&gt;    array array_count_values  ( array $input  )&lt;br /&gt; -- returns an array using the values of the input  array as keys and their frequency in input  as values. &lt;br /&gt; -- Case Insensitive&lt;br /&gt;------------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;array_diff_assoc()&lt;/b&gt;&lt;br /&gt; -- syntax&lt;br /&gt;    array array_diff_assoc  ( array $array1  , array $array2  [, array $...  ] )&lt;br /&gt; -- Computes the difference of arrays with additional index check. Returns an array with the elements in first array which are not present in rest of arrays.&lt;br /&gt;------------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;array_diff_uassoc&lt;/b&gt;&lt;br /&gt; -- syntax&lt;br /&gt;    Computes the difference of arrays with additional index check which is performed by a user supplied callback function&lt;br /&gt; -- sample use : $result = array_diff_uassoc($array1, $array2, "key_compare_func");&lt;br /&gt; -- converse function : array_intersect_assoc()&lt;br /&gt;------------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;array_diff_key&lt;/b&gt;&lt;br /&gt; -- syntax&lt;br /&gt;    array array_diff_key  ( array $array1  , array $array2  [, array $...  ] )&lt;br /&gt; -- Computes the difference of arrays using keys for comparison.&lt;br /&gt; -- Converse function : array_intersect_key()&lt;br /&gt;------------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;array_diff_ukey()&lt;/b&gt;&lt;br /&gt; -- syntax&lt;br /&gt; -- Computes the difference of arrays using a callback function on the keys for comparison&lt;br /&gt; -- sample use&lt;br /&gt;    var_dump(array_diff_ukey($array1, $array2, 'key_compare_func'));&lt;br /&gt;------------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;array_diff()&lt;/b&gt;&lt;br /&gt; -- syntax&lt;br /&gt;    array array_diff  ( array $array1  , array $array2  [, array $ ...  ] )&lt;br /&gt; -- Compares array1  against array2  and returns the difference. &lt;br /&gt;------------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;array_fill_keys()&lt;/b&gt;&lt;br /&gt; -- syntax&lt;br /&gt; -- Sample use&lt;br /&gt;    $arr1 = array(0 =&gt; 'abc', 1 =&gt; 'def');&lt;br /&gt;    $arr2 = array(0 =&gt; 452, 1 =&gt; 128);&lt;br /&gt;&lt;br /&gt;    array_fill_keys($arr1,$arr2);&lt;br /&gt;    returns: [abc] =&gt; 452, [def] =&gt; 128&lt;br /&gt;------------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;array_fill()&lt;/b&gt;&lt;br /&gt; -- syntax&lt;br /&gt;    array array_fill  ( int $start_index  , int $num  , mixed $value  )&lt;br /&gt; -- Creates an array with starting index as $start_index and with $num no of elements and value of each element will be taken from $value&lt;br /&gt;------------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;array_filter()&lt;/b&gt;&lt;br /&gt; -- syntax&lt;br /&gt;    array_filter($array,'function_name');&lt;br /&gt; -- Iterate through each array element and pass each of them to callback function specified as second argument.&lt;br /&gt;------------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;array_flip&lt;/b&gt;&lt;br /&gt; -- syntax&lt;br /&gt;    array array_flip  ( array $trans  )&lt;br /&gt; -- Exchanges all keys with their associated values in an array&lt;br /&gt;    Array keys becomes values and values become keys.&lt;br /&gt;------------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;&lt;/b&gt;&lt;br /&gt; -- syntax&lt;br /&gt; -- &lt;br /&gt;------------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;&lt;/b&gt;&lt;br /&gt; -- syntax&lt;br /&gt; -- &lt;br /&gt;------------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;&lt;/b&gt;&lt;br /&gt; -- syntax&lt;br /&gt; -- &lt;br /&gt;------------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;&lt;/b&gt;&lt;br /&gt; -- syntax&lt;br /&gt; --&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-3617348346703385794?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/3617348346703385794/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/04/array-functions-and-questions-interview.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/3617348346703385794'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/3617348346703385794'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/04/array-functions-and-questions-interview.html' title='array functions and questions interview'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-4791433245080713955</id><published>2009-04-05T23:11:00.000-07:00</published><updated>2009-05-28T23:04:12.589-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='zend'/><category scheme='http://www.blogger.com/atom/ns#' term='zend framework tutorial'/><title type='text'>Zend framework Captcha-sample image captcha code</title><content type='html'>Zend framework is based on number of different components for different purposes. Zend framework has a component &lt;u&gt;( Zend_Captcha )&lt;/u&gt; for &lt;b&gt;use of captcha in web forms&lt;/b&gt;. &lt;b&gt;CAPTCHA  stands for &lt;/b&gt; "Completely Automated Public Turing test to tell Computers and Humans Apart".&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Overview of a component&lt;/b&gt;&lt;br /&gt;Component     : Zend_Captcha&lt;br /&gt;php extension : gd&lt;br /&gt;use           : Can be used as standalone or with &lt;b&gt;Zend_Form&lt;/b&gt;&lt;br /&gt;Adapters      : Zend_Captcha_Word&lt;br /&gt;                Zend_Captcha_Image&lt;br /&gt;                Zend_Captcha_Dumb&lt;br /&gt;                Zend_Captcha_Figlet&lt;br /&gt;                Zend_Captcha_ReCaptcha&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Adapter details&lt;/b&gt;&lt;br /&gt;&lt;b&gt;1.Zend_Captcha_Word&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;All word based adapters make use of this adapter. &lt;u&gt;Zend_Captcha_Figlet&lt;/u&gt;, &lt;u&gt;Zend_Captcha_Dumb&lt;/u&gt;, &lt;u&gt;Zend_Captcha_Image&lt;/u&gt; extends this abstract class. &lt;br /&gt;&lt;br /&gt;&lt;u&gt;Zend_Captcha_Word&lt;/u&gt; is actually a base class for all these &lt;u&gt;word based captcha adapters&lt;/u&gt;. &lt;br /&gt;&lt;br /&gt;This is an abstract class and cant be instantiated directly.&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;2.Zend_Captcha_Image&lt;/b&gt;&lt;br /&gt;This also extends Zend_Captcha_Word. This is a very commonly used captcha. And zend really made it easy to use... so take a look at the sample code below...&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How to use Zend_Captcha_Image in form? Sample code is here.&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;$form-&gt;addElement('Captcha','captcha',array(&lt;br /&gt;  'label'      =&gt; 'Please enter the 5 letters displayed below:',&lt;br /&gt;  'required'   =&gt; true,&lt;br /&gt;  'captcha'    =&gt; array(&lt;br /&gt;    'captcha' =&gt; 'image', &lt;br /&gt;    'name'    =&gt; 'foo',&lt;br /&gt;    'wordLen' =&gt; 6,&lt;br /&gt;    'font' =&gt; DOC_ROOT.'/html/captcha/arial.ttf',&lt;br /&gt;    'fontSize' =&gt; 30,&lt;br /&gt;    'imgDir' =&gt; DOC_ROOT.'/html/captcha',&lt;br /&gt;    'imgUrl' =&gt; 'http://sagagolf/captcha/',&lt;br /&gt;    'timeout' =&gt; 300) &lt;br /&gt;                       ));&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;3.Zend_Captcha_Figlet&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;This &lt;u&gt;captcha adapter&lt;/u&gt; is also a word based so it extends &lt;b&gt;Zend_Captcha_Word&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;This adapter is limited to &lt;b&gt;generate only the characters and no integers&lt;/b&gt;. &lt;br /&gt;&lt;br /&gt;Take a look at this &lt;b&gt;sample code&lt;/b&gt; below, if you want to use the &lt;b&gt;Zend_Captcha_Figlet with Zend_Form.&lt;/b&gt; You can write the validations also in this code.&lt;br /&gt;&lt;br /&gt;$form-&gt;addElement('Captcha','captcha',array(&lt;br /&gt; 'label'   =&gt; 'Please enter the 5 letters displayed below:',&lt;br /&gt; 'name'    =&gt; 'figlet',&lt;br /&gt; 'required' =&gt; true,&lt;br /&gt; 'captcha' =&gt; array(&lt;br /&gt; 'captcha' =&gt; 'figlet',&lt;br /&gt;        'wordLen' =&gt; 4&lt;br /&gt;  )&lt;br /&gt; )); &lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;4.Zend_Captcha_Dumb&lt;/b&gt;&lt;br /&gt;Zend_Captcha_Dumb is a very very basic captcha which simply create random string which may consists integers and characters.&lt;br /&gt;&lt;br /&gt;This adapter is a word based so it extends Zend_Captcha_Word.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Sample use/code for using Zend_Captcha_Dumb&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;$form-&gt;addElement('Captcha','captcha',array(&lt;br /&gt; 'label'   =&gt; 'Please enter the 5 letters displayed below:',&lt;br /&gt; 'name'    =&gt; 'captcha',&lt;br /&gt; 'required' =&gt; true,&lt;br /&gt; 'captcha' =&gt; array(&lt;br /&gt; 'captcha' =&gt; 'dumb',&lt;br /&gt;        'wordLen' =&gt; 4,&lt;br /&gt; 'timeOut' =&gt; 5&lt;br /&gt;  )&lt;br /&gt; ));&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;5.Zend_Captcha_ReCaptcha&lt;/b&gt;&lt;br /&gt;The ReCaptcha adapter utilizes &lt;u&gt;Zend_Service_ReCaptcha&lt;/u&gt; to generate and &lt;u&gt;validate captchas&lt;/u&gt;.&lt;br /&gt;----------------------------------------------------------------------&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-4791433245080713955?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/4791433245080713955/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/04/zend-framework-captcha-sample-image.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/4791433245080713955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/4791433245080713955'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/04/zend-framework-captcha-sample-image.html' title='Zend framework Captcha-sample image captcha code'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-3269415581426520554</id><published>2009-03-27T23:02:00.000-07:00</published><updated>2009-03-27T23:12:05.370-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php functions'/><category scheme='http://www.blogger.com/atom/ns#' term='file operations'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='date'/><title type='text'>filemtime how to get the date of creation modified file</title><content type='html'>Php has set of file related function , which helps us to get complete details of the file creation and modification etc.... Lets take a look at the simple code which gives us the &lt;b&gt;creation / last modification date and time&lt;/b&gt; of any file.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Snippet&lt;/b&gt;&lt;br /&gt;&lt;?php&lt;br /&gt;// filemtime is a php function which gives us the last modified info of any file&lt;br /&gt;&lt;br /&gt;$file_modified_on = date("l, dS F, Y @ h:ia",filemtime($path_to_file));&lt;br /&gt;&lt;br /&gt;echo "File was modified on &gt; ".$file_modified_on;&lt;br /&gt;&lt;br /&gt;?&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Syntax of filemtime()&lt;/b&gt;&lt;br /&gt;int filemtime ( string $path_to_file )&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Description of filemtime()&lt;/b&gt;&lt;br /&gt;Function returns the modification time of specified file.&lt;br /&gt;It returns &lt;b&gt;ERROR&lt;/b&gt; in case of error.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-3269415581426520554?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/3269415581426520554/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/03/filemtime-how-to-get-date-of-creation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/3269415581426520554'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/3269415581426520554'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/03/filemtime-how-to-get-date-of-creation.html' title='filemtime how to get the date of creation modified file'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-3569347935381445363</id><published>2009-03-16T06:00:00.000-07:00</published><updated>2009-03-16T23:47:37.637-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><title type='text'>what is mysql fulltext search</title><content type='html'>Mysql has a feature called fulltext search.&lt;br /&gt;We can implement a fulltext search on any column of the database table.&lt;br /&gt;&lt;br /&gt;Things to be noted while implementing the Fulltext searches in mysql table.&lt;br /&gt;&lt;br /&gt;1. Queries that are longer than 20 characters will not be sorted&lt;br /&gt;2. First, MySQL automatically orders the results by their relevancy rating.&lt;br /&gt;3. The fields in the MATCH() should be identical to the fields listed in the &lt;br /&gt;   table's FULLTEXT definition.&lt;br /&gt;4. Another thing to note is that FULLLTEXT indices are not case sensitive.&lt;br /&gt;5. FULLTEXT indices are NOT supported in InnoDB tables.&lt;br /&gt;6. MySQL requires that you have at least three rows of data in your result set   &lt;br /&gt;   before it will return any results.&lt;br /&gt;7. By default, your search query must be at least four characters long and may not &lt;br /&gt;   exceed 254 characters.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-3569347935381445363?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/3569347935381445363/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/03/what-is-mysql-fulltext-search.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/3569347935381445363'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/3569347935381445363'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/03/what-is-mysql-fulltext-search.html' title='what is mysql fulltext search'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-6181842690378675357</id><published>2009-02-23T01:08:00.000-08:00</published><updated>2009-02-23T01:21:15.926-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='memory management'/><category scheme='http://www.blogger.com/atom/ns#' term='php tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Errors in php'/><title type='text'>single quote vs double quote php memory problem</title><content type='html'>Just think on following statements for one moment.&lt;br /&gt;&lt;br /&gt;$strLit = 'Php';&lt;br /&gt;&lt;br /&gt;echo $strLit.' is server side programming language';&lt;br /&gt;&lt;br /&gt;echo "$strLit is server side programming language";&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You might be thinking that what is the difference in these echo statements, they work same and produces same output. you are right , both statements produces same output but parsing variable within a string takes more memory then the first echo statement , because the first echo statement uses a string concatenation. So if you are writing a code which uses lots of memory then &lt;b&gt;avoid use of "" double quotes and variable inside the string&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 0, 0);"&gt;&lt;b&gt;simple is string concatenation and single quotes.&lt;/b&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-6181842690378675357?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/6181842690378675357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/02/single-quote-vs-double-quote-php-memory.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/6181842690378675357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/6181842690378675357'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/02/single-quote-vs-double-quote-php-memory.html' title='single quote vs double quote php memory problem'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-5343713980073019410</id><published>2009-01-30T00:28:00.000-08:00</published><updated>2009-01-30T00:41:24.147-08:00</updated><title type='text'>htaccess Mod_Rewrite seo friendly url</title><content type='html'>Apache has lots of interesting modules, in this post I will explain a magical modules of apache web server . i.e. mod_rewrite.&lt;br /&gt;&lt;br /&gt;This module simply rewrites the requests. &lt;br /&gt;&lt;b&gt;What does url rewriting mean?&lt;/b&gt;&lt;br /&gt;lets take an example of a shopping cart website in which you have a page which displays products in particular category depending upon category id passed in url.&lt;br /&gt;&lt;br /&gt;e.g. - &gt; category.php?catid=29&lt;br /&gt;&lt;br /&gt;now just look at this url &lt;br /&gt;mobiles/29.html    -&gt; this url is more expressive than the above url. So it is a SEO friendly url. URL itself describes the page contents.&lt;br /&gt;&lt;br /&gt;And this job is done by &lt;b&gt;mod_rewrite&lt;/b&gt; module of apache.&lt;br /&gt;&lt;br /&gt;go through this sample example or rewriting url.&lt;br /&gt;RewriteEngine On&lt;br /&gt;RewriteRule mobile/29.html category.php?catid=29&lt;br /&gt;&lt;br /&gt;This simply rewrite mobile/29.html in to category.php?catid=29.&lt;br /&gt;is int it simple???&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-5343713980073019410?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/5343713980073019410/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/01/htaccess-modrewrite-seo-friendly-url.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/5343713980073019410'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/5343713980073019410'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/01/htaccess-modrewrite-seo-friendly-url.html' title='htaccess Mod_Rewrite seo friendly url'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-3785422110590220008</id><published>2009-01-09T21:26:00.001-08:00</published><updated>2009-01-09T21:32:29.333-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='css style sheet'/><title type='text'>CSS Properties To JavaScript</title><content type='html'>&lt;h1&gt;CSS Property JavaScript Reference&lt;/h1&gt;Are you looking for "any property in css to use in javascript"? Take a look at below list of all &lt;b&gt;css properties&lt;/b&gt; to &lt;b&gt;javascript properties&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt; - CSS - &lt;br /&gt;classname&lt;br /&gt;{&lt;br /&gt;  background-color:#fff;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;If you want to do same in javascript on the fly then you can simply write following javascript code.&lt;br /&gt;&lt;br /&gt; - JavaScript - &lt;br /&gt;obj = document.getElementById("eleId");&lt;br /&gt;obj.style.backgroundColor="#fff";&lt;br /&gt;&lt;br /&gt;Done&lt;br /&gt;&lt;br /&gt;background -&gt; background&lt;br /&gt;background-attachment -&gt; backgroundAttachment&lt;br /&gt;background-color -&gt; backgroundColor&lt;br /&gt;background-image -&gt; backgroundImage&lt;br /&gt;background-position -&gt; backgroundPosition&lt;br /&gt;background-repeat -&gt; backgroundRepeat&lt;br /&gt;border -&gt; border&lt;br /&gt;border-bottom -&gt; borderBottom&lt;br /&gt;border-bottom-color -&gt; borderBottomColor&lt;br /&gt;border-bottom-style -&gt; borderBottomStyle&lt;br /&gt;border-bottom-width -&gt; borderBottomWidth&lt;br /&gt;border-color -&gt; borderColor&lt;br /&gt;border-left -&gt; borderLeft&lt;br /&gt;border-left-color -&gt; borderLeftColor&lt;br /&gt;border-left-style -&gt; borderLeftStyle&lt;br /&gt;border-left-width -&gt; borderLeftWidth&lt;br /&gt;border-right -&gt; borderRight&lt;br /&gt;border-right-color -&gt; borderRightColor&lt;br /&gt;border-right-style -&gt; borderRightStyle&lt;br /&gt;border-right-width -&gt; borderRightWidth&lt;br /&gt;border-style -&gt; borderStyle&lt;br /&gt;border-top -&gt; borderTop&lt;br /&gt;border-top-color -&gt; borderTopColor&lt;br /&gt;border-top-style -&gt; borderTopStyle&lt;br /&gt;border-top-width -&gt; borderTopWidth&lt;br /&gt;border-width -&gt; borderWidth&lt;br /&gt;clear -&gt; clear&lt;br /&gt;clip -&gt; clip&lt;br /&gt;color -&gt; color&lt;br /&gt;cursor -&gt; cursor&lt;br /&gt;display -&gt; display&lt;br /&gt;filter -&gt; filter&lt;br /&gt;font -&gt; font&lt;br /&gt;font-family -&gt; fontFamily&lt;br /&gt;font-size -&gt; fontSize&lt;br /&gt;font-variant -&gt; fontVariant&lt;br /&gt;font-weight -&gt; fontWeight&lt;br /&gt;height -&gt; height&lt;br /&gt;left -&gt; left&lt;br /&gt;letter-spacing -&gt; letterSpacing&lt;br /&gt;line-height -&gt; lineHeight&lt;br /&gt;list-style -&gt; listStyle&lt;br /&gt;list-style-image -&gt; listStyleImage&lt;br /&gt;list-style-position -&gt; listStylePosition&lt;br /&gt;list-style-type -&gt; listStyleType&lt;br /&gt;margin -&gt; margin&lt;br /&gt;margin-bottom -&gt; marginBottom&lt;br /&gt;margin-left -&gt; marginLeft&lt;br /&gt;margin-right -&gt; marginRight&lt;br /&gt;margin-top -&gt; marginTop&lt;br /&gt;overflow -&gt; overflow&lt;br /&gt;padding -&gt; padding&lt;br /&gt;padding-bottom -&gt; paddingBottom&lt;br /&gt;padding-left -&gt; paddingLeft&lt;br /&gt;padding-right -&gt; paddingRight&lt;br /&gt;padding-top -&gt; paddingTop&lt;br /&gt;page-break-after -&gt; pageBreakAfter&lt;br /&gt;page-break-before -&gt; pageBreakBefore&lt;br /&gt;position -&gt; position&lt;br /&gt;float -&gt; styleFloat&lt;br /&gt;text-align -&gt; textAlign&lt;br /&gt;text-decoration -&gt; textDecoration&lt;br /&gt;text-decoration: blink -&gt; textDecorationBlink&lt;br /&gt;text-decoration: line-through -&gt; textDecorationLineThrough&lt;br /&gt;text-decoration: none -&gt; textDecorationNone&lt;br /&gt;text-decoration: overline -&gt; textDecorationOverline&lt;br /&gt;text-decoration: underline -&gt; textDecorationUnderline&lt;br /&gt;text-indent -&gt; textIndent&lt;br /&gt;text-transform -&gt; textTransform&lt;br /&gt;top -&gt; top&lt;br /&gt;vertical-align -&gt; verticalAlign&lt;br /&gt;visibility -&gt; visibility&lt;br /&gt;width -&gt; width&lt;br /&gt;z-index -&gt; zIndex&lt;br /&gt;&lt;br /&gt;Contact on above email address if you need more information on javascript and css.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-3785422110590220008?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/3785422110590220008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2009/01/css-properties-to-javascript.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/3785422110590220008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/3785422110590220008'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2009/01/css-properties-to-javascript.html' title='CSS Properties To JavaScript'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-4304365152230454629</id><published>2008-11-28T07:24:00.000-08:00</published><updated>2009-01-13T00:54:29.557-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php functions'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='string functions'/><title type='text'>php string functions list</title><content type='html'>&lt;h1&gt;String functions php&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;PHP&lt;/b&gt; is reffered as very strong &lt;b&gt;server side scripting language&lt;/b&gt;, because of its huge set of in reached functions. There are more than &lt;b&gt;700 functions&lt;/b&gt; in &lt;u&gt;php&lt;/u&gt;. &lt;b&gt;PHP&lt;/b&gt; really have lots of built in functions, so developer dosen't need to write small snippets for small operations. PHP's function set consists of variety of functions including,&lt;br /&gt;&lt;br /&gt;&lt;b&gt;String manuplation functions&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Array handling functions&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Image processing functions&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Mail related functions&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Mathematical functions&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Functions for XML manuplation&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;In this post, I am trying to &lt;b&gt;list all&lt;/b&gt; the &lt;b&gt;important string function in php&lt;/b&gt;.&lt;br /&gt;&lt;table style="border:1px solid black; border-collapse: collapse;" border="1" cellpadding="4" cellspacing="2" width="430"&gt;&lt;tbody&gt;&lt;tr class="a1"&gt;&lt;td width="80" &gt;&lt;span class="style3"&gt;addcslashes&lt;/span&gt;&lt;br/&gt;&lt;/td&gt;&lt;td&gt;Quote string with &lt;b&gt;slashes&lt;/b&gt; in a C style. "Magicquotes"&lt;/td&gt;&lt;/tr&gt;&lt;tr class="a1"&gt;&lt;td colspan="2"&gt;Syntax : string addcslashes  ( string $str  , string $charlist  )&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;bin2hex&lt;/span&gt;&lt;/td&gt;&lt;td&gt;Convert &lt;b&gt;binary data&lt;/b&gt; into hexadecimal representation.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan="2"&gt;string bin2hex  ( string $str  )&lt;/td&gt;&lt;/tr&gt;&lt;tr class="a1"&gt;&lt;td&gt;&lt;span class="style3"&gt;chop&lt;/span&gt;&lt;/td&gt;&lt;td&gt;Alias of &lt;b&gt;rtrim().&lt;/b&gt; Remove white spaces from right isde of string.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;chr&lt;/span&gt;&lt;/td&gt;&lt;td&gt;Return a specific character&lt;/td&gt;&lt;/tr&gt;&lt;tr class="a1"&gt;&lt;td&gt;&lt;span class="style3"&gt;chunk_split&lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Split a string&lt;/b&gt; into smaller chunks&lt;/td&gt;&lt;/tr&gt;&lt;tr class="a1"&gt;&lt;td colspan="2"&gt;string chunk_split  ( string $body  [, int $chunklen  [, string $end  ]] )&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;convert_cyr_string&lt;/span&gt;&lt;/td&gt;&lt;td&gt;Convert from one Cyrillic character set to another &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan="2"&gt;string convert_cyr_string  ( string $str  , string $from  , string $to  )&lt;/td&gt;&lt;/tr&gt;&lt;tr class="a1"&gt;&lt;td&gt;&lt;span class="style3"&gt;convert_uudecode &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Decode a uuencoded &lt;b&gt;string&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr class="a1"&gt;&lt;td colspan="2"&gt;string convert_uudecode  ( string $data  )&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;convert_uuencode &lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Uuencode&lt;/b&gt; a string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan="2"&gt;string convert_uuencode  ( string $data  )&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;count_chars &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Return information about &lt;b&gt;characters&lt;/b&gt; used in a &lt;b&gt;string&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan="4"&gt;count_chars  ( string $string  [, int $mode  ] )&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;crc32 &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Calculates the&lt;b&gt; crc32&lt;/b&gt; polynomial of a string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan="2"&gt;int crc32  ( string $str  )&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;crypt &lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;One-way string encryption&lt;/b&gt; (hashing)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;echo &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Output one or more strings&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;explode &lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;p&gt;&lt;b&gt;Split a string&lt;/b&gt; by string.&lt;/p&gt;&lt;p&gt;Syntax:explode('-','php-freelancer');&lt;/p&gt;&lt;p&gt;Return: array.&lt;br&gt;&lt;a href="www.phpexplode.blogspot.com" target="_blank" title="click to view comple tutorial on php explode and its syntax"&gt;More about php explode&lt;/a&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;fprintf &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Write a &lt;b&gt;formatted string&lt;/b&gt; to a stream&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;get_html_translation_table &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Returns the translation table used by htmlspecialchars() and htmlentities()&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;hebrev &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Convert logical Hebrew text to &lt;b&gt;visual text&lt;/b&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;hebrevc &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Convert &lt;b&gt;logical Hebrew&lt;/b&gt; text to visual text with newline conversion &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;html_entity_decode &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Convert all &lt;b&gt;HTML entities&lt;/b&gt; to their applicable characters &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;htmlentities &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Convert all applicable characters to &lt;b&gt;HTML entities&lt;/b&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;htmlspecialchars_decode &lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Convert special HTML entities&lt;/b&gt; back to characters &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;htmlspecialchars &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Convert special characters to &lt;b&gt;HTML entities&lt;/b&gt; &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;implode &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Join array &lt;b&gt;elements &lt;/b&gt;with a &lt;b&gt;string&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;join &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Alias of &lt;b&gt;implode()&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;levenshtein &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Calculate Levenshtein distance between two strings&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;localeconv &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Get numeric formatting information&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;ltrim &lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Strip/remove whitespace&lt;/b&gt; (or other characters) from the beginning of a string &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;md5_file &lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Calculates the md5 hash&lt;/b&gt; of a given file&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;md5 &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Calculate the &lt;b&gt;md5&lt;/b&gt; hash of a string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;metaphone &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Calculate the &lt;b&gt;metaphone key&lt;/b&gt; of a string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;money_format &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Formats a number as a &lt;b&gt;currency string&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;nl_langinfo &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Query language and locale information&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;nl2br &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Inserts &lt;b&gt;HTML line breaks&lt;/b&gt; before all newlines in a string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;number_format &lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Format a number&lt;/b&gt; with grouped thousands&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;ord &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Return &lt;b&gt;ASCII&lt;/b&gt; value of character&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;parse_str &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Parses the &lt;b&gt;string&lt;/b&gt; into variables&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;print &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Output a string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;printf &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Output a &lt;b&gt;formatted string&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;quoted_printable_decode &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Convert a &lt;b&gt;quoted-printable&lt;/b&gt; string to an 8 bit string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;quotemeta &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Quote meta &lt;b&gt;characters&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;rtrim &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Strip whitespace (or other characters) from the end of a string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;setlocale &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Set locale information&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;sha1_file &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Calculate the sha1 hash of a file&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;sha1 &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Calculate the sha1 hash of a string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;similar_text &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Calculate the similarity between &lt;b&gt;two strings&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;soundex &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Calculate the &lt;b&gt;soundex key&lt;/b&gt; of a string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;sprintf &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Return a formatted string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;sscanf &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Parses input from a string according to a format&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;str_ireplace &lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Case-insensitive&lt;/b&gt; version of str_replace().&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;str_pad &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Pad a string to a certain length with another string &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;str_replace &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Replace all occurrences of the &lt;b&gt;search string&lt;/b&gt; with the replacement string &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;str_rot13 &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Perform the rot13 transform on a string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;str_shuffle &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Randomly &lt;b&gt;shuffles a string&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;str_split &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Convert a &lt;b&gt;string to an array&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;str_word_count &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Return information about words used in a &lt;b&gt;string&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strcasecmp &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Binary safe case-insensitive string comparison&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strchr &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Alias of strstr()&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strcmp &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Binary safe string comparison&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strcoll &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Locale based string comparison&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strcspn &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Find length of initial segment not matching mask&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strip_tags &lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Strip HTML and PHP&lt;/b&gt; tags from a string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;stripcslashes &lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Un-quote&lt;/b&gt; string quoted with addcslashes()&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;stripos &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Find position of &lt;b&gt;first occurrence&lt;/b&gt; of a case-insensitive string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;stripslashes &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Un-quote string quoted with addslashes()&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;stristr &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Case-insensitive strstr() &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strlen &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Get string length&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strnatcasecmp &lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Case insensitive string&lt;/b&gt; comparisons using a "natural order" algorithm&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strnatcmp &lt;/span&gt;&lt;/td&gt;&lt;td&gt;String comparisons using a "natural order" algorithm&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strncasecmp &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Binary safe &lt;b&gt;case-insensitive string&lt;/b&gt; comparison of the first n characters&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strncmp &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Binary safe string comparison of the first n characters&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strpbrk &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Search a string for any of a set of characters&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strpos &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Find position of first occurrence of a string &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strrchr &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Find the last occurrence of a character in a string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strrev &lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Reverse a string&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strripos &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Find position of &lt;b&gt;last occurrence&lt;/b&gt; of a case-insensitive string in a string &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strrpos &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Find position of &lt;b&gt;last occurrence&lt;/b&gt; of a char in a string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strspn &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Find length of initial segment matching mask &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strstr &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Find first occurrence of a string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strtok &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Tokenize string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strtolower &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Make a string &lt;b&gt;lowercase&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strtoupper &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Make a string &lt;b&gt;uppercase&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;strtr &lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Translate certain characters&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;substr_compare &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Binary safe optionally case insensitive comparison of 2 strings from an offset, up to length characters&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;substr_count &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Count the &lt;b&gt;number of substring&lt;/b&gt; occurrences&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;substr_replace &lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Replace text&lt;/b&gt; within a portion of a string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;substr &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Return part of a string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;trim &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Strip whitespace (or other characters) from the beginning and end of a string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;ucfirst &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Make a string's first character uppercase&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;ucwords &lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Uppercase&lt;/b&gt; the first character of each word in a string &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;vfprintf &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Write a formatted string to a stream&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;vprintf &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Output a formatted string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;vsprintf &lt;/span&gt;&lt;/td&gt;&lt;td&gt;Return a formatted string&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;span class="style3"&gt;wordwrap &lt;/span&gt;&lt;/td&gt;&lt;td&gt;&lt;b&gt;Wraps&lt;/b&gt; a string to a given number of characters using a string break character&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-4304365152230454629?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/4304365152230454629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2008/11/php-string-functions-list.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/4304365152230454629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/4304365152230454629'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2008/11/php-string-functions-list.html' title='php string functions list'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-6749701324160714861</id><published>2008-11-27T02:44:00.000-08:00</published><updated>2008-11-27T03:35:33.085-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>mysql-fetch-assoc-vs-mysql-fetch-array</title><content type='html'>&lt;h4&gt;What is the difference between mysql_fetch_assoc() and mysql_fetch_array()?&lt;/h4&gt;&lt;br /&gt;php has lots of functions to fetch the data from mysql database. Here I am just trying to make out the &lt;b&gt;difference between mysql_fetch_assoc() and mysql_fetch_array()&lt;/b&gt; functions of php.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;mysql_fetch_assoc()&lt;/b&gt; is equivalent to calling &lt;b&gt;mysql_fetch_array()&lt;/b&gt; with MYSQL_ASSOC for the optional second parameter. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;mysql_fetch_assoc()&lt;/b&gt; is also doesn't really need to exist because it just returns the key names insted of Numeric keys and key names which happens in mysql_fetch_array.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;'Associative arrays'&lt;/b&gt; returned by &lt;b&gt;mysql_fetch_assoc()&lt;/b&gt; are arrays with  key names so , they're more human readable.&lt;br /&gt;&lt;br /&gt;Some times &lt;b&gt;mysql_fetch_assoc()&lt;/b&gt; is faster than &lt;b&gt;mysql_fetch_array()&lt;/b&gt; .&lt;br /&gt;&lt;br /&gt;&lt;b&gt;mysql_fetch_assoc()&lt;/b&gt; may also need less memory as it generates an array of key names insted of keynames and key indexes in &lt;b&gt;mysql_fetch_array()&lt;/b&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-6749701324160714861?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/6749701324160714861/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2008/11/mysql-fetch-assoc-vs-mysql-fetch-array.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/6749701324160714861'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/6749701324160714861'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2008/11/mysql-fetch-assoc-vs-mysql-fetch-array.html' title='mysql-fetch-assoc-vs-mysql-fetch-array'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-4971442115301557700</id><published>2008-11-27T02:27:00.000-08:00</published><updated>2008-11-27T03:34:56.740-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>javascript setTimeout() recursion code</title><content type='html'>&lt;h1&gt;recursion with javascript setTimeout()&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Purose of setTimeout function&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;We always use &lt;b&gt;setTimeout()&lt;/b&gt; function of &lt;u&gt;Javascript&lt;/u&gt; to execute some statement after some time interval. It dosent mean browser stops the execution at &lt;u&gt;setTimeout&lt;/u&gt; statement. Infact browser just run the complete set script including the &lt;b&gt;setTimeout function&lt;/b&gt;, and just keep in reminder that the statement written in &lt;u&gt;setTimeout's&lt;/u&gt; first parameter has to be executed after some time duration.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Syntax&lt;/u&gt;&lt;br /&gt; setTimeout("",1000);&lt;br /&gt; first parameter  : Statement to be executed.&lt;br /&gt; second parameter : Time interval in ms.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How to write recursive script with this function?&lt;/b&gt;&lt;br /&gt;Directly see the sample code below.&lt;br /&gt;&lt;br /&gt;function call_me_recursively()&lt;br /&gt;{&lt;br /&gt;   /*&lt;br /&gt;    some code here&lt;br /&gt;   */&lt;br /&gt;   setTimeout(function() { call_me_recursively() },1000 );&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;It works.&lt;br /&gt;Best of luck..&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-4971442115301557700?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/4971442115301557700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2008/11/javascript-settimeout-recursion-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/4971442115301557700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/4971442115301557700'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2008/11/javascript-settimeout-recursion-code.html' title='javascript setTimeout() recursion code'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-3104253844244071338</id><published>2008-11-22T10:10:00.002-08:00</published><updated>2008-11-23T10:01:18.725-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='shell script'/><title type='text'>Shell Script - how to write</title><content type='html'>&lt;h1&gt;How to write shell script&lt;/h1&gt;&lt;br /&gt;&lt;div&gt;A shell is a command line interpretor. It takes commands and executes them. We can run N no of common commands one after another by putting them in one file( shell script ) in proper order.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Creating a simple shell file&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;suppose you want to view the some files in some directory regularly. so you need to use following command:&lt;br /&gt;&lt;strong&gt;find /path/to/folder/*.ext -mtime 30 -type f -exec ls -lh {} \;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This will display all files which are 30 days older from given folder path .&lt;br /&gt;&lt;br /&gt;we can do this task in shell script as follows&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;#!/bin/sh&lt;br /&gt;find /path/to/folder/*.ext -mtime 30 -type f -exec ls -lh {} \;&lt;br /&gt;exit 0&lt;/strong&gt;&lt;br /&gt;_______________________________________________________________&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How to create shell script file with vi editor.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;1. vi file_name.sh - create the shell file&lt;br /&gt;&lt;br /&gt;2. First statement of shell file should be&lt;br /&gt;#!/bin/sh - start of shell script&lt;br /&gt;&lt;br /&gt;3. write all commands one after another. - all commands to be executed&lt;br /&gt;&lt;br /&gt;4.End of shell script - end of shell script&lt;br /&gt;exit 0&lt;br /&gt;&lt;br /&gt;5.come out of vi editor and run the shell file - run the shell file&lt;br /&gt;./file_name.sh&lt;br /&gt;&lt;br /&gt;simple.................&lt;br /&gt;_______________________________________________________________&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Passing value to shell script&lt;/strong&gt;&lt;br /&gt;We can also pass the arguments to our shell script. In our example we are displaying all the files which are modified 30 days before. Now suppose we want to see all the files which are modified 10 days before , then we need to make change in our shell script. To avoid this we can pass the date count to our script from command line. Just go through the sample file given below.&lt;br /&gt;&lt;br /&gt;e.g.&lt;br /&gt;#!/bin/sh&lt;br /&gt;clear&lt;br /&gt;echo *SCRIPT NAME = $0&lt;br /&gt;echo *No Of Parameters = $#&lt;br /&gt;echo *Parameters List = $*&lt;br /&gt;echo List of files modified before $1 days.&lt;br /&gt;find /path/to/folder/*.ext -mtime $1 -type f -exec ls -lh {} \;&lt;br /&gt;exit 0&lt;br /&gt;&lt;br /&gt;* echo is used to write output.&lt;br /&gt;* $0 gives the script name.&lt;br /&gt;* $# gives no of parameter count.&lt;br /&gt;* $* gives a string of all parameters to script&lt;br /&gt;* Individual argument can be accessed with $1,$2,$3,$4,$5.............&lt;br /&gt;$1 for first parameter and so on..&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How to execute &lt;/strong&gt;&lt;br /&gt;./file_name.sh +10&lt;br /&gt;In this case +10 is passed to our shell script as first parameter and thus script runs accordingly.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-3104253844244071338?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/3104253844244071338/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2008/11/shell-script-how-to-write.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/3104253844244071338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/3104253844244071338'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2008/11/shell-script-how-to-write.html' title='Shell Script - how to write'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-7793585455847329552</id><published>2008-11-22T10:10:00.001-08:00</published><updated>2008-11-22T10:10:43.161-08:00</updated><title type='text'>Create Your Orkut Application</title><content type='html'>&lt;div&gt;Steps to create orkut applications.&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;Platform &lt;/strong&gt;&lt;br /&gt;    Orkut applications can be created in XML.&lt;br /&gt;&lt;br /&gt;1. Start with the sandbox account on &lt;span style="color:#3366ff;"&gt;http://sandbox.orkut.com&lt;/span&gt; .&lt;br /&gt;     Register on http://code.google.com/support/opensocialsignup/&lt;br /&gt;2. Once your account get active , you can start developing your application in sandbox.&lt;br /&gt;3. You can add your XML application by clicking on add application tab.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;HELP&lt;/strong&gt; &lt;img alt="" src="http://www.fropper.com/zones-ssi/fckeditor/editor/images/smiley/msn/lightbulb.gif" /&gt;&lt;br /&gt;http://code.google.com/apis/orkut/docs/orkutdevguide.html&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;First Time developing application? &lt;img alt="" src="http://www.fropper.com/zones-ssi/fckeditor/editor/images/smiley/msn/lightbulb.gif" /&gt;&lt;/strong&gt;&lt;br /&gt;http://code.google.com/apis/orkut/articles/tutorial/tutorial.html&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-7793585455847329552?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/7793585455847329552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2008/11/create-your-orkut-application.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/7793585455847329552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/7793585455847329552'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2008/11/create-your-orkut-application.html' title='Create Your Orkut Application'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-4701972246323322593</id><published>2008-11-22T10:09:00.000-08:00</published><updated>2008-11-23T10:02:41.252-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='css style sheet'/><title type='text'>CSS Properties To JavaScript</title><content type='html'>&lt;h1&gt;CSS Property  vs JavaScript Reference&lt;/h1&gt;&lt;br /&gt;Check out the following list for all javascript Reference for all CSS styles.&lt;br /&gt;&lt;br /&gt;background -&gt; background&lt;br /&gt;background-attachment -&gt; backgroundAttachment&lt;br /&gt;background-color -&gt; backgroundColor&lt;br /&gt;background-image  -&gt; backgroundImage&lt;br /&gt;background-position  -&gt; backgroundPosition&lt;br /&gt;background-repeat  -&gt; backgroundRepeat&lt;br /&gt;border   -&gt; border&lt;br /&gt;border-bottom   -&gt; borderBottom&lt;br /&gt;border-bottom-color -&gt; borderBottomColor&lt;br /&gt;border-bottom-style -&gt; borderBottomStyle&lt;br /&gt;border-bottom-width  -&gt; borderBottomWidth&lt;br /&gt;border-color   -&gt; borderColor&lt;br /&gt;border-left   -&gt; borderLeft&lt;br /&gt;border-left-color  -&gt; borderLeftColor&lt;br /&gt;border-left-style  -&gt; borderLeftStyle&lt;br /&gt;border-left-width  -&gt; borderLeftWidth&lt;br /&gt;border-right   -&gt; borderRight&lt;br /&gt;border-right-color  -&gt; borderRightColor&lt;br /&gt;border-right-style  -&gt; borderRightStyle&lt;br /&gt;border-right-width  -&gt; borderRightWidth&lt;br /&gt;border-style   -&gt; borderStyle&lt;br /&gt;border-top   -&gt; borderTop&lt;br /&gt;border-top-color  -&gt; borderTopColor&lt;br /&gt;border-top-style  -&gt; borderTopStyle&lt;br /&gt;border-top-width  -&gt; borderTopWidth&lt;br /&gt;border-width   -&gt; borderWidth&lt;br /&gt;clear   -&gt; clear&lt;br /&gt;clip   -&gt; clip&lt;br /&gt;color   -&gt; color&lt;br /&gt;cursor   -&gt; cursor&lt;br /&gt;display   -&gt; display&lt;br /&gt;filter   -&gt; filter&lt;br /&gt;font   -&gt; font&lt;br /&gt;font-family   -&gt; fontFamily&lt;br /&gt;font-size   -&gt; fontSize&lt;br /&gt;font-variant   -&gt; fontVariant&lt;br /&gt;font-weight   -&gt; fontWeight&lt;br /&gt;height   -&gt; height&lt;br /&gt;left   -&gt; left&lt;br /&gt;letter-spacing   -&gt; letterSpacing&lt;br /&gt;line-height   -&gt; lineHeight&lt;br /&gt;list-style   -&gt; listStyle&lt;br /&gt;list-style-image  -&gt; listStyleImage&lt;br /&gt;list-style-position  -&gt; listStylePosition&lt;br /&gt;list-style-type  -&gt; listStyleType&lt;br /&gt;margin   -&gt; margin&lt;br /&gt;margin-bottom   -&gt; marginBottom&lt;br /&gt;margin-left   -&gt; marginLeft&lt;br /&gt;margin-right   -&gt; marginRight&lt;br /&gt;margin-top   -&gt; marginTop&lt;br /&gt;overflow   -&gt; overflow&lt;br /&gt;padding   -&gt; padding&lt;br /&gt;padding-bottom   -&gt; paddingBottom&lt;br /&gt;padding-left   -&gt; paddingLeft&lt;br /&gt;padding-right   -&gt; paddingRight&lt;br /&gt;padding-top   -&gt; paddingTop&lt;br /&gt;page-break-after  -&gt; pageBreakAfter&lt;br /&gt;page-break-before  -&gt; pageBreakBefore&lt;br /&gt;position   -&gt; position&lt;br /&gt;float   -&gt; styleFloat&lt;br /&gt;text-align   -&gt; textAlign&lt;br /&gt;text-decoration  -&gt; textDecoration&lt;br /&gt;text-decoration: blink  -&gt; textDecorationBlink&lt;br /&gt;text-decoration: line-through  -&gt; textDecorationLineThrough&lt;br /&gt;text-decoration: none   -&gt; textDecorationNone&lt;br /&gt;text-decoration: overline  -&gt; textDecorationOverline&lt;br /&gt;text-decoration: underline  -&gt; textDecorationUnderline&lt;br /&gt;text-indent   -&gt; textIndent&lt;br /&gt;text-transform   -&gt; textTransform&lt;br /&gt;top   -&gt; top&lt;br /&gt;vertical-align   -&gt; verticalAlign&lt;br /&gt;visibility   -&gt; visibility&lt;br /&gt;width   -&gt; width&lt;br /&gt;z-index   -&gt; zIndex&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-4701972246323322593?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/4701972246323322593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2008/11/css-properties-to-javascript.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/4701972246323322593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/4701972246323322593'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2008/11/css-properties-to-javascript.html' title='CSS Properties To JavaScript'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-8088122724205290441</id><published>2008-11-22T10:08:00.000-08:00</published><updated>2008-11-22T10:14:27.477-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>How to detect the firebug.</title><content type='html'>I use this to detect the firebug.&lt;br /&gt;&lt;br /&gt;&lt;script language="javascript"&gt;&lt;br /&gt;if(typeof window.loadFirebugConsole != "undefined")&lt;br /&gt;{&lt;br /&gt;  alert("Firebug is enabled..");&lt;br /&gt;}&lt;br /&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-8088122724205290441?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/8088122724205290441/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2008/11/how-to-detect-firebug.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/8088122724205290441'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/8088122724205290441'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2008/11/how-to-detect-firebug.html' title='How to detect the firebug.'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-4151512398660636426</id><published>2008-11-22T10:07:00.000-08:00</published><updated>2008-11-22T10:12:44.429-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='shell script'/><title type='text'>How to check the empty directory in shell script</title><content type='html'>&lt;strong&gt;&lt;span style="font-family:Comic Sans MS;font-size:180%;color:#ff0000;"&gt;How to check the empty directory in shell script? &lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This can be easily done with the help &lt;strong&gt;ls&lt;/strong&gt; command.&lt;br /&gt;we can simply check the empty directory using following script.&lt;br /&gt;&lt;br /&gt;DIR="/path/to/directory/"&lt;br /&gt;&lt;br /&gt;if [ "$(ls -A $DIR)" ]; then&lt;br /&gt;           echo "Take action $DIR is not Empty"&lt;br /&gt;else&lt;br /&gt;           echo "$DIR is Empty"&lt;br /&gt;&lt;br /&gt;You can also assign the output of specific command to a separate variable instead of checking it directly in if condition.&lt;br /&gt;e.g.&lt;br /&gt;&lt;br /&gt;myVar=`(grep 'stringToSearch' filename.ext)`;&lt;br /&gt;&lt;br /&gt;Note: Do not use spaces before and after =.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-4151512398660636426?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/4151512398660636426/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2008/11/how-to-check-empty-directory-in-shell.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/4151512398660636426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/4151512398660636426'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2008/11/how-to-check-empty-directory-in-shell.html' title='How to check the empty directory in shell script'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-8746319819054596560</id><published>2008-11-22T10:05:00.000-08:00</published><updated>2008-11-23T10:04:11.385-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>What is JSON - Alternative to XML</title><content type='html'>&lt;h1&gt;What is JSON&lt;/h1&gt;&lt;strong&gt;&lt;span style="font-family:Comic Sans MS;font-size:180%;color:#ff0000;"&gt;Javascript Object Notation&lt;br /&gt;&lt;br /&gt;JSON make easy to interchange between programming language to JavaScript.&lt;br /&gt;&lt;br /&gt;JSON is class/library that we can use to convert a variable from PHP variable to JavaScript Variable.&lt;br /&gt;&lt;br /&gt;its another way to use javascript on your site and not have to worry about people having it turned off since doesn't require javascrpt tags to actually run it.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;it make programing in javascript quicker and more effective.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;It is a Fat-Free Alternative to XML.&lt;br /&gt;&lt;br /&gt;It is a new data interchange format.&lt;br /&gt;&lt;br /&gt;JSON data can be included from websites outside the domain origin of the web application (avoiding the same-origin limitations of XMLHttpRequest) by using JSON-in-script.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;JSON can be be used as an alternative to XML representation of data with the added benefits that JSON is easier to "parse" for JavaScript client code&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;Sample code snippet to generate JSON string for php array.&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;'the first', 'b'=&gt;'is second');&lt;br /&gt;&lt;br /&gt;$json = new JSON();&lt;br /&gt;&lt;br /&gt;echo $json-&gt;convert($myArray);&lt;br /&gt;?&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1.) You can download the JSON.php file from this link:&lt;br /&gt;&lt;img alt="" src="http://www.fropper.com/zones-ssi/fckeditor/editor/images/smiley/msn/lightbulb.gif" /&gt; http://mike.teczno.com/JSON/JSON.phps&lt;br /&gt;&lt;br /&gt;check out following code.&lt;br /&gt;&lt;br /&gt;require_once("JSON.php");&lt;br /&gt;&lt;br /&gt;$myArray = Array('a'=&gt;'the first', 'b'=&gt;'is second');&lt;br /&gt;&lt;br /&gt;$json = new Services_JSON();&lt;br /&gt;&lt;br /&gt;echo $json-&gt;encode($myArray);&lt;br /&gt;&lt;br /&gt;Output :&lt;br /&gt;{"a":"the first","b":"is second"}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Comic Sans MS;"&gt;&lt;strong&gt;&lt;span style="font-size:180%;color:#ff0000;"&gt;How to turn xml into json:&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;img alt="" src="http://www.fropper.com/zones-ssi/fckeditor/editor/images/smiley/msn/lightbulb.gif" /&gt; http://www-128.ibm.com/developerworks/xml/library/x-xml2jsonphp/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-8746319819054596560?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/8746319819054596560/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2008/11/what-is-json-alternative-to-xml.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/8746319819054596560'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/8746319819054596560'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2008/11/what-is-json-alternative-to-xml.html' title='What is JSON - Alternative to XML'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-3913945972956989675</id><published>2008-11-22T06:24:00.001-08:00</published><updated>2008-11-23T10:00:02.061-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>memory management in php</title><content type='html'>&lt;h1&gt;Memory management - php &lt;/h1&gt;&lt;br /&gt;&lt;u&gt;Why memory problems occurs in our script??&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;Some time you might have came accross the following &lt;b&gt;memory problem&lt;/b&gt; while executing your &lt;u&gt;php script.&lt;/u&gt;&lt;br /&gt;&lt;a href="http://php-tuts.blogspot.com/2008/11/fatal-error-allowed-memory-size-of.html" title="Memory management in php "&gt;&lt;b&gt;Fatal error: Allowed memory size of 8388608 bytes exhausted.&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;- We will start with php.ini.&lt;br /&gt;In php configuration file ( php.ini ) there is a directive for &lt;u&gt;memory limit&lt;/u&gt; that php script can use during the execution.&lt;br /&gt;&lt;b&gt;memory_limit&lt;/b&gt;&lt;br /&gt;* Default memory limit is set in php.ini file ( php configuration file.)&lt;br /&gt;* memory_limit = 8M;&lt;br /&gt;&lt;br /&gt;Every time we create any variable or array some amount of space is allocated to that variable, and when this memory allocation exceeds the memory_limit ( in php.ini ) , the script throws the &lt;b&gt;fatal error&lt;/b&gt; of allowed memory size.&lt;br /&gt;&lt;br /&gt;If we are using any include file in loop then also this error may occure. If we are including any php file in loop , script try to create more n more variables and at some stage this loop creates &lt;a href="http://php-tuts.blogspot.com/2008/11/fatal-error-allowed-memory-size-of.html" title="Memory management in php "&gt;memory management problem&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;Always use &lt;b&gt;memory_get_usage&lt;/b&gt; function after certain block of codes in your script to find which block of code is occupying more memory, then apply respected steps.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://php-tuts.blogspot.com/2008/11/fatal-error-allowed-memory-size-of.html" title="solve Memory management in php "&gt;Click here to view all possible solutions on php memory management problems.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-3913945972956989675?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/3913945972956989675/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2008/11/memory-management-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/3913945972956989675'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/3913945972956989675'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2008/11/memory-management-in-php.html' title='memory management in php'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-7692624505072942415</id><published>2008-11-22T05:58:00.000-08:00</published><updated>2008-11-22T10:05:12.966-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>cacheing technique : server page cache</title><content type='html'>&lt;div align="justify"&gt;Hi guys.&lt;br /&gt;Do you know the technique to create &lt;b&gt;server side cacheing&lt;/b&gt; with php?&lt;br /&gt;It is very simple and easy to understand. &lt;b&gt;Page level&lt;/b&gt; &lt;b&gt;server cache&lt;/b&gt; can be implemented by using the concept of &lt;b&gt;output buffer&lt;/b&gt; and other output buffer handling functions.&lt;u&gt;Output buffer is responcible to hold&lt;/u&gt; the data after ob_start() statement. So we can cache the complete page by writing simply &lt;b&gt;ob_start();&lt;/b&gt; at the beginning of page ( where output starts) and can write the content of output buffer in separate file. This file will now be treated as page level cache file for the main page.&lt;/div&gt;&lt;div align="justify"&gt;Simple steps to &lt;a href="http://royads.blogspot.com/2008/02/server-page-cache-in-php.html"&gt;obtainn server side cacheing.&lt;/a&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;b&gt;1.&lt;/b&gt; use &lt;b&gt;ob_start()&lt;/b&gt;;&lt;/div&gt;&lt;div align="justify"&gt;Every HTML output generated by your php page will be stored in output buffer. Output buffer is a php function.&lt;/div&gt;&lt;div align="justify"&gt;&lt;b&gt;2.&lt;/b&gt; Write the contents of current output buffer to any HTML file.&lt;/div&gt;&lt;div align="justify"&gt;&lt;b&gt;3.&lt;/b&gt; Stop the output buffering and clear the buffer. Any HTML output generated by your page after this statement will not be stored in output buffer.&lt;/div&gt;&lt;div align="justify"&gt;OB_flush();&lt;/div&gt;&lt;div align="justify"&gt;&lt;b&gt;4.&lt;/b&gt; For next request of same page will be drawn from this cached HTML file and not by your actual php file.&lt;/div&gt;&lt;div align="justify"&gt;&lt;b&gt;Where to use page cache in php?&lt;/b&gt;&lt;/div&gt;&lt;div align="justify"&gt;This type of server cacheing technique of php can only be used to avoid database hits in subsequent requests. But this is also applicable if and only if your data is not going to change for cached time. &lt;/div&gt;&lt;div align="justify"&gt;Sample code for &lt;b&gt;server side data cacheing&lt;/b&gt; is here.&lt;br /&gt;&lt;pre&gt;&lt;code class="php"&gt;&lt;code class="php"&gt;MyCache&lt;/code&gt;&lt;code class="php"&gt;file = 'MyCache/cached.html';&lt;br /&gt;$cachetime = 5 * 60;&lt;br /&gt;// Serve from the cache if it is younger than $cachetime&lt;br /&gt;if (file_exists(&lt;/code&gt;&lt;code class="php"&gt;$&lt;/code&gt;&lt;code class="php"&gt;MyCache&lt;/code&gt;&lt;code class="php"&gt;file&lt;/code&gt;&lt;code class="php"&gt;) &amp;amp;&amp;amp; time() - $cachetime &lt;&gt;&lt;code class="php"&gt;$&lt;/code&gt;&lt;code class="php"&gt;MyCache&lt;/code&gt;&lt;code class="php"&gt;file&lt;/code&gt;&lt;code class="php"&gt;)) {&lt;br /&gt;include(&lt;/code&gt;&lt;code class="php"&gt;$&lt;/code&gt;&lt;code class="php"&gt;MyCache&lt;/code&gt;&lt;code class="php"&gt;file&lt;/code&gt;&lt;code class="php"&gt;);&lt;br /&gt;echo "&lt;!-- Cached copy, generated ".date('H:i', filemtime(&lt;/code&gt;&lt;code class="php"&gt;$&lt;/code&gt;&lt;code class="php"&gt;MyCache&lt;/code&gt;&lt;code class="php"&gt;file&lt;/code&gt;&lt;code class="php"&gt;))." --&gt;\n";&lt;br /&gt;exit;&lt;br /&gt;}&lt;br /&gt;ob_start(); // Start the output buffer&lt;br /&gt;&lt;br /&gt;/* The code to dynamically generate the page goes here */&lt;br /&gt;&lt;br /&gt;// Cache the output to a file&lt;br /&gt;$fp = fopen(&lt;/code&gt;&lt;code class="php"&gt;$&lt;/code&gt;&lt;code class="php"&gt;MyCache&lt;/code&gt;&lt;code class="php"&gt;file&lt;/code&gt;&lt;code class="php"&gt;, 'w');&lt;br /&gt;fwrite($fp, ob_get_contents());&lt;br /&gt;fclose($fp);&lt;br /&gt;ob_end_flush();&lt;br /&gt;?&gt;&lt;/code&gt;&lt;/code&gt;&lt;/code&gt;&lt;/pre&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-7692624505072942415?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/7692624505072942415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2008/11/cacheing-technique-server-page-cache.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/7692624505072942415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/7692624505072942415'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2008/11/cacheing-technique-server-page-cache.html' title='cacheing technique : server page cache'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-5579976396802153012</id><published>2008-11-22T05:57:00.000-08:00</published><updated>2008-11-23T10:05:13.120-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>install php install</title><content type='html'>&lt;h1&gt;How to install php apache mysql&lt;/h1&gt;&lt;br /&gt;This post if for all &lt;u&gt;php beginners&lt;/u&gt; who dont know &lt;b&gt;how to install php&lt;/b&gt;, and searching for &lt;b&gt;php installation steps&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Prerequisites&lt;/b&gt;&lt;br /&gt;In order to install and learn php on your local computer system you need &lt;b&gt;php&lt;/b&gt;&lt;br /&gt;&lt;b&gt;installation&lt;/b&gt; and an server software as well i.e.(Apache/IIS).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;First we have to &lt;b&gt;install apache server&lt;/b&gt; and then &lt;b&gt;php&lt;/b&gt; and &lt;b&gt;mysql&lt;/b&gt;.&lt;br /&gt;so go through following steps to install apache server on your local system.&lt;br /&gt;-------------------------------------------------------------------------------------&lt;br /&gt;Download the latest Win32 Binary (MSI Installer) of apache web server.&lt;br /&gt;&lt;a href="http://httpd.apache.org/download.cgi" target="_blank"&gt;click here for apache installation&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You should download following version.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Version&lt;/b&gt;: 2.0.55&lt;br /&gt;&lt;b&gt;File Name&lt;/b&gt;: apache_2.0.55-win32-x86-no_ssl.msi&lt;br /&gt;&lt;br /&gt;1. Download the apache installation file i.e. apache_2.0.55-win32-x86-no_ssl.msi.&lt;br /&gt;2. Double click it and start the apache installation.&lt;br /&gt;3. It is a normal installation so no need of brief explanation.&lt;br /&gt;4. The installation wizard will ask you some fields "Network domain", "server name", "administrators email id" etc - you can enter anything in this fields.&lt;br /&gt;5. Then choose typical installation and click on next button.&lt;br /&gt;6. Finish the installation.&lt;br /&gt;7. Open http://localhost/ and you will see the apache test page.&lt;br /&gt;8. Apache installation is done.&lt;br /&gt;&lt;br /&gt;Apache server's configuration settings is stored in a file called &lt;strong&gt;httpd.conf&lt;/strong&gt;.&lt;br /&gt;This file is located at C:\Program Files\Apache Group\Apache2\conf\ directory. You have to edit this file while installing php.&lt;br /&gt;_____________________________________________________________&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Install PHP&lt;/b&gt;&lt;br /&gt;On the PHP download page, click on the zip package under the Windows Binaries section to download php. &lt;a href="http://php.net/downloads.php" target="_blank"&gt;CLICLK HERE FOR PHP&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You should download following version.&lt;br /&gt;&lt;b&gt;Version:&lt;/b&gt; 5.1.2&lt;br /&gt;&lt;b&gt;File Name:&lt;/b&gt; php-5.1.2-Win32.zip.&lt;br /&gt;&lt;br /&gt;-------------------------------------------------------------------------------------&lt;br /&gt;Now go through following simple steps to &lt;b&gt;install php&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;1. Extract php-5.1.2-Win32.zip to C:\php.&lt;br /&gt;2. There is one file in php directory ( php-ini-recommended.ini ).&lt;br /&gt;This is a configuration file of php.&lt;br /&gt;Create a copy of this php configuration file and rename it to c:\php\php.ini.&lt;br /&gt;3. Now open php.ini file in any text editor which you like and do the following changes and then save it.&lt;br /&gt;&lt;br /&gt;a)Uncomment the "include_path" on. line 505.&lt;br /&gt;include_path = ".;C:\php\includes"&lt;br /&gt;&lt;br /&gt;b)Change the "doc_root" to match your httpd.conf DocumentRoot directory. line 512.&lt;br /&gt;doc_root = "C:\Program Files\Apache Group\Apache2\htdocs"&lt;br /&gt;&lt;br /&gt;c)Change "extension_dir". Line 519.&lt;br /&gt;extension_dir = "C:\php\ext"&lt;br /&gt;&lt;br /&gt;d)Change "session.save_path" and "session.cookie_path" on&lt;br /&gt;line no 939 &amp;amp; 958, respectively&lt;br /&gt;session.save_path = "C:\Temp"&lt;br /&gt;session.cookie_path = \&lt;br /&gt;&lt;br /&gt;4. Add C:\php to your PATH System Environment Variable&lt;br /&gt;a.Right-click on My Computer and choose Properties.&lt;br /&gt;b.Select the Advanced tab.&lt;br /&gt;c.Click Environment Variables.&lt;br /&gt;d.Under System variables, select “Path” and choose Edit.&lt;br /&gt;e.Move the cursor to the end of the string and add&lt;br /&gt;;C:\php. A basic path will look something like the following:&lt;br /&gt;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\php&lt;br /&gt;5. Click ok and finish it.&lt;br /&gt;&lt;br /&gt;6.Open your httpd.conf file located at C:\Program Files\Apache Group\Apache2\conf\ and Append the following lines.&lt;br /&gt;&lt;br /&gt;LoadModule php5_module "c:/php/php5apache2.dll"&lt;br /&gt;&lt;br /&gt;AddType application/x-httpd-php .php&lt;br /&gt;&lt;br /&gt;PHPIniDir "C:/php"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;7.Add index.php to the DirectoryIndex, and then save. Line 321.&lt;br /&gt;DirectoryIndex index.php index.html index.html.var&lt;br /&gt;&lt;br /&gt;8. Restart the apache server and check that test apache page is displaying or not.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-5579976396802153012?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/5579976396802153012/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2008/11/install-php-install.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/5579976396802153012'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/5579976396802153012'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2008/11/install-php-install.html' title='install php install'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-7686354424587854901</id><published>2008-11-22T05:56:00.000-08:00</published><updated>2008-11-23T10:06:15.568-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='website security'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>hacker proof PHP MySQL development</title><content type='html'>&lt;b&gt;&lt;h1&gt;Hacker proof PHP MySQL&lt;/h1&gt;&lt;/b&gt;Who &lt;u&gt;hack&lt;/u&gt; your website?&lt;br /&gt;Answer : You.&lt;br /&gt;&lt;div style="TEXT-ALIGN: justify"&gt;( Hackers use many &lt;u&gt;hacking techniques&lt;/u&gt; to hack your website or web server. But up to certain extent it is because of programmer. Confuse?? )&lt;br /&gt;Programmer has to take precautions to prevent there script from &lt;b&gt;hack attack&lt;/b&gt;. If you didn't think and code improperly then you increase the chance of your script being &lt;u&gt;hacked&lt;/u&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(255,102,0);font-size:130%;" &gt;&lt;b&gt;Hack prevention Techniques / Tips&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Study following &lt;b&gt;hack prevention techniques&lt;/b&gt; to develop a &lt;b&gt;secure and hack safe php mysql web application.&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;1. Protect all secure directories.&lt;/b&gt;&lt;br /&gt;.htaccess file is our friend. Use &lt;b&gt;.htaccess&lt;/b&gt; file to protect your secure directories.&lt;br /&gt;&lt;a href="http://www.cs.dal.ca/studentservices/faq/tutorials/web_sites/htaccess.shtml"&gt;Click here for more help on how to protect the directory using .htaccess&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;2. Set your server configuration properly&lt;/b&gt;&lt;br /&gt;&lt;div style="TEXT-ALIGN: justify"&gt;Set the &lt;b&gt;register_globals&lt;/b&gt; setting to OFF. This you can do by editing your php.ini file. php.ini is the php configuration file which controls the behavior of your script. &lt;b&gt;Register_globals&lt;/b&gt; is a PHP setting that controls the availability of variables by super global arrays of php ( i. e. $_SESSION, $_POST,$_REQUEST,$_GET,$_COOKIE n all super global arrays).&lt;br /&gt;register_globals = "on" =&gt; less secure .&lt;br /&gt;register_globals = "off" =&gt; more secure .&lt;br /&gt;this setting is removed from php version 6.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;3. Never trust the user data.&lt;/b&gt;&lt;br /&gt;Never trust the data entered by user from the web forms. Validate all the user inputs either from POST form data or from GET query strings.&lt;br /&gt;Always escape the user data.&lt;br /&gt;study these setting and functions of php to achive this.&lt;br /&gt;1. magic_quotes&lt;br /&gt;2. addslashes()&lt;br /&gt;3. stripcslashes()&lt;br /&gt;4. strip_tags()&lt;br /&gt;5. mysql_escape_string()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;4. Move Config and files&lt;/b&gt; containing Passwords to mysql to a Secure directory outside of the public_html folder.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;5. Turn off Display Error/Warning Messages.&lt;/b&gt;&lt;br /&gt;set error_display to ZERO&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-7686354424587854901?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/7686354424587854901/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2008/11/hacker-proof-php-mysql-development.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/7686354424587854901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/7686354424587854901'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2008/11/hacker-proof-php-mysql-development.html' title='hacker proof PHP MySQL development'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-207575563654574170</id><published>2008-11-22T05:43:00.000-08:00</published><updated>2008-11-22T10:05:12.967-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='Errors in php'/><title type='text'>Fatal error: Allowed memory size of 8388608 bytes exhausted php</title><content type='html'>&lt;span style="font-size: 130%;"&gt;&lt;span style="font-size: 85%;"&gt;sometime PHP script may returns the above error. Normally this error is generated when your script exchausted and used up the default memory requirement of 8 MB memory allocation.&lt;br /&gt;&lt;br /&gt;* Default memory limit is set in php.ini file ( php configuration file.) &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;* memory_limit = 8M;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How can we manage with the memory problems comes in some php scripts?&lt;/strong&gt;&lt;br /&gt;you should check following things when such kind of memory errors occurs in your script.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;strong&gt;1. &lt;/strong&gt;&lt;/span&gt;check the default &lt;strong&gt;memory_limit&lt;/strong&gt; variable in your php.ini file.&lt;br /&gt;   memory_limit = 8M;&lt;br /&gt;   you can change this memory limit and again check for the error.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;   a. Edit in php.ini&lt;/strong&gt;&lt;br /&gt;       memory_limit = 12M;&lt;br /&gt;       restart the apache service.&lt;br /&gt;&lt;strong&gt;   b. code Level&lt;/strong&gt;&lt;br /&gt;       @ini_set('memory_limit', '12M');&lt;br /&gt;&lt;strong&gt;  c. htaccess&lt;/strong&gt;&lt;br /&gt;     php_value memory_limit 12M&lt;br /&gt;___________________________________________________________________&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;strong&gt;2.&lt;/strong&gt;&lt;/span&gt; If the error is not resolved after above step, then you should start debugging your code in order to find out the reason of memory limit exceed.&lt;br /&gt;You have to first find out at what position in your code the memory limit is exceeding. you can use the php's built in function for this purpose.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Function description&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="background-color: rgb(255, 255, 0);"&gt;&lt;strong&gt;memory_get_usage&lt;/strong&gt;&lt;/span&gt; — This function returns the amount of memory allocated to PHP.&lt;br /&gt;&lt;br /&gt;Syntax : int memory_get_usage ( true / false );&lt;br /&gt;&lt;br /&gt;It returns the amount of memory, in bytes, that's currently being allocated to your PHP script.&lt;br /&gt;&lt;br /&gt;Set the option to this function to TRUE to get the real size of memory allocated from system. If not set or FALSE only the memory used by emalloc() is returned.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;How to use this function&lt;br /&gt;&lt;br /&gt;&lt;/u&gt;1. Write this code ( echo memory_get_usage( true ); ) repeteadly after some no of lines. &lt;u&gt;&lt;br /&gt;&lt;/u&gt;2. Run it in browser&lt;u&gt;&lt;br /&gt;&lt;/u&gt;3. Compare the counts given by each echo and you can check which block of your code needs extra memory.&lt;u&gt;&lt;br /&gt;&lt;/u&gt;4. Once you identify the block of code which needs extra memory then you can start deallocating the unused memory spaces allocated by some unused variables and some infinite loops.&lt;u&gt;&lt;br /&gt;&lt;/u&gt;5. use following wherever necessary.&lt;br /&gt;    a. unset($var_name);&lt;br /&gt;    b. mysql_free_result($result_set); — Free result memory&lt;br /&gt;    c. Look for include("file.php") in loops, by mistake.&lt;br /&gt;    Just try to free the memory everywhere if the variable / array is no longer used.&lt;br /&gt;6. Best of luck.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Function description&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;bool &lt;strong&gt;&lt;span style="background-color: rgb(255, 255, 0);"&gt;mysql_free_result&lt;/span&gt;&lt;span style="background-color: rgb(255, 255, 0);"&gt; &lt;/span&gt;&lt;/strong&gt;( resource $result )&lt;br /&gt;It frees all the memory associated with the result identifier result .&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-207575563654574170?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/207575563654574170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2008/11/fatal-error-allowed-memory-size-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/207575563654574170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/207575563654574170'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2008/11/fatal-error-allowed-memory-size-of.html' title='Fatal error: Allowed memory size of 8388608 bytes exhausted php'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-2478019796752902964</id><published>2008-11-22T05:38:00.000-08:00</published><updated>2008-11-23T10:09:29.299-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='website security'/><title type='text'>Cross Site Scripting XSS browser attacks</title><content type='html'>&lt;h1&gt;Cross Site Scripting XSS&lt;/h1&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Now a days Web applications are becoming more and more dynamic. Dynamic websites means contents shown on web page are pulled dynamically depending on some settings. These setting may include sending some important variables in query string, or sending the data entered by users with post form type. So in simple words we can say that your dynamic web application needs some contents / data inputs from user, and this is the point where &lt;strong&gt;Cross Site Scripting&lt;/strong&gt;&lt;br /&gt;(XSS) comes in picture.&lt;br /&gt;As your dynamic web application is accepting some data from users or from query string. Some users get the front door open to enter in your application and put there codes in your application. These Codes may include HTML code and/or JavaScript , any client-side scripts. &lt;strong&gt;Cross-site scripting&lt;/strong&gt; technique is carried out on websites were roughly 80% of all documented security vulnerabilities.&lt;br /&gt;&lt;/div&gt;&lt;strong&gt;&lt;br /&gt;What is XSS?&lt;/strong&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Usually attacker encodes some part of the links in HEX, and puts this in your web page through query string. So that script can be anything and we cant predict the behavior of such attacks to the web application.&lt;br /&gt;&lt;/div&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;div style="text-align: justify;"&gt;&lt;strong&gt;Attack example&lt;/strong&gt; : A simple JavaScript to read cookie is added to your page and then this cookie is sent to attackers action page which records all the information in the cookie created by yuor web application.&lt;br /&gt;&lt;/div&gt;&lt;strong&gt;&lt;br /&gt;Refer folowing url&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt; src="" text="&lt; script"&gt;alert(document.cookie)&lt; / script&gt;"&gt; &lt; / iframe&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;If we are using the variable $text somewhere in our page and it is not escaped then this URL will render a new iframe on the place where you are using the $text variable.&lt;br /&gt;In this way you can insert any of your script in another webpages and fool the users to get important information from them. But normally in such kind of attckes user never understand that there important information is being hacked by some other application.&lt;br /&gt;This is the simple thing and will not cause much damage to your sitee, but attacker can do much more than this with the help of XSS.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;strong&gt;Other XSS attacks&lt;/strong&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Attackers may inject JavaScript, VBScript, ActiveX, HTML in webpages.&lt;br /&gt;This kind of attacks are done for hacking user accounts , changing of user settings, cookie theft, or advertising.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;strong&gt;How to prevent such attacks ? &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Clensing the Query String&lt;/strong&gt; variables is the only way you can prevent such attackers.&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;Clensing the Query String - PHP :&lt;br /&gt;&lt;/strong&gt;string &lt;span style="color: rgb(255, 0, 0);"&gt;strip_tags&lt;/span&gt; ( string $str [, string $allowable_tags ] )&lt;br /&gt;This function tries to return a string with all HTML and PHP tags stripped from a given str.&lt;br /&gt;&lt;br /&gt;string &lt;span style="color: rgb(255, 0, 0);"&gt;htmlentities&lt;/span&gt; ( string $string [, int $quote_style [, string $charset [, bool $double_encode ]]] )&lt;br /&gt;&lt;br /&gt;use above functions or you can write your own function which combines all such stripping functionlities.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-2478019796752902964?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/2478019796752902964/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2008/11/cross-site-scripting-xss-browser.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/2478019796752902964'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/2478019796752902964'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2008/11/cross-site-scripting-xss-browser.html' title='Cross Site Scripting XSS browser attacks'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-8636169944838792633</id><published>2008-11-16T03:11:00.000-08:00</published><updated>2008-11-22T10:05:12.968-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>PHP filter_input validate and filter User Inputs</title><content type='html'>PHP5 comes up with all new functionalities and lots of new extensions. While developing any web application we have to think about the &lt;b&gt;security of that web application.&lt;/b&gt;&lt;br /&gt;PHP5 has introduced its all new &lt;b&gt;Filter Functions&lt;/b&gt; , which consists of really good and powerful filter functions helping developers to filter the external user inputs to there web application. Now a days web applications are becoming more dynamic than static. As web application become more dynamic , It accept more inputs from users, and this is the main &lt;b&gt;security concern.&lt;/b&gt;. Thanks to php5 for introducing new set of &lt;u&gt;filter functions&lt;/u&gt; which really help to make your application &lt;b&gt;more secure&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;PHP filters are used to validate and filter data coming from insecure sources.&lt;br /&gt;e.g. User Inputs...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Comic Sans MS;font-size:130%;color:#ff0000;"&gt;&lt;strong&gt;PHP filter_input() Function&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;With filter_input() function we can filter out the data from following sources.&lt;br /&gt;&lt;br /&gt;1. INPUT_GET&lt;br /&gt;2. INPUT_POST&lt;br /&gt;3. INPUT_COOKIE&lt;br /&gt;4. INPUT_ENV&lt;br /&gt;5. INPUT_SERVER&lt;br /&gt;6. INPUT_SESSION (Not yet implemented)&lt;br /&gt;7. INPUT_REQUEST (Not yet implemented)&lt;br /&gt;&lt;br /&gt;this function returns the filtered variable data on success and &lt;strong&gt;returns FALSE&lt;/strong&gt; on the  failure or of filter action.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:Comic Sans MS;font-size:130%;color:#ff0000;"&gt;&lt;strong&gt;Syntax&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;filter_input(input_type, variable, filter, options)&lt;br /&gt;&lt;br /&gt;input_type =  Above List of sources. e.g . INPUT_GET , INPUT_POST.&lt;br /&gt;variable     =  Variable to be validated.&lt;br /&gt;filter           =  Specifies the ID of the filter to use. &lt;strong&gt;Default is FILTER_SANITIZE_STRING. &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Here is the list of php filters.&lt;/strong&gt;&lt;br /&gt;ID Name                                             Description&lt;br /&gt;FILTER_CALLBACK------------------Call a user-defined function to filter data&lt;br /&gt;FILTER_SANITIZE_STRING-------Strip tags, optionally strip or encode special characters&lt;br /&gt;FILTER_SANITIZE_STRIPPED---  Alias of "string" filter&lt;br /&gt;FILTER_SANITIZE_ENCODED--- URL-encode string, optionally strip or encode special&lt;br /&gt;                                                            characters&lt;br /&gt;FILTER_SANITIZE_SPECIAL_CHARS  &lt;br /&gt;                                                            HTML-escape '"&lt;&gt;&amp;amp; and characters with ASCII value less than&lt;br /&gt;                                                            32&lt;br /&gt;FILTER_SANITIZE_EMAIL----------Remove all characters, except letters, digits and               &lt;br /&gt;                                                            !#$%&amp;amp;'*+-/=?^_`{|}~@.[]&lt;br /&gt;FILTER_SANITIZE_URL------------Remove all characters, except letters, digits and $-_.+!*'(),&lt;br /&gt;                                                            {}|\\^~[]`&lt;&gt;#%";/?:@&amp;amp;=&lt;br /&gt;FILTER_SANITIZE_NUMBER_INT----Remove all characters, except digits and +-&lt;br /&gt;FILTER_SANITIZE_NUMBER_FLOAT----Remove all characters, except digits, +- and optionally&lt;br /&gt;                                                            .,eE&lt;br /&gt;FILTER_SANITIZE_MAGIC_QUOTES----- Apply addslashes()&lt;br /&gt;FILTER_UNSAFE_RAW----------------------- Do nothing, optionally strip or encode special&lt;br /&gt;-------------------------------------------------------- characters&lt;br /&gt;FILTER_VALIDATE_INT----------------------- Validate value as integer, optionally from the specified&lt;br /&gt;-------------------------------------------------------- range&lt;br /&gt;FILTER_VALIDATE_BOOLEAN--------------  Return TRUE for "1", "true", "on" and "yes", FALSE for&lt;br /&gt;-------------------------------------------------------- "0", "false", "off", "no", and "", NULL otherwise&lt;br /&gt;FILTER_VALIDATE_FLOAT------------------- Validate value as float&lt;br /&gt;FILTER_VALIDATE_REGEXP---------------- Validate value against regexp, a Perl-compatible&lt;br /&gt;------------------------------------------------------- regular expression&lt;br /&gt;FILTER_VALIDATE_URL--------------------- Validate value as URL, optionally with required&lt;br /&gt;------------------------------------------------------  components&lt;br /&gt;FILTER_VALIDATE_EMAIL------------------  Validate value as e-mail&lt;br /&gt;FILTER_VALIDATE_IP------------------------ Validate value as IP address, optionally only IPv4 or&lt;br /&gt;------------------------------------------------------ IPv6 or not from private or reserved ranges&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-8636169944838792633?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://php-tuts.blogspot.com/feeds/8636169944838792633/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://php-tuts.blogspot.com/2008/11/php-filterinput-validate-and-filter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/8636169944838792633'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2063777811819971705/posts/default/8636169944838792633'/><link rel='alternate' type='text/html' href='http://php-tuts.blogspot.com/2008/11/php-filterinput-validate-and-filter.html' title='PHP filter_input validate and filter User Inputs'/><author><name>php helper</name><uri>http://www.blogger.com/profile/01385856676507855900</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
