<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.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" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0"><id>tag:blogger.com,1999:blog-2063777811819971705</id><updated>2012-05-16T23:23:51.210-07: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="alternate" type="text/html" href="http://php-tuts.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/2063777811819971705/posts/default?start-index=26&amp;max-results=25&amp;orderby=updated" /><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>55</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/blogspot/php-tutorials" /><feedburner:info uri="blogspot/php-tutorials" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>blogspot/php-tutorials</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry><id>tag:blogger.com,1999:blog-2063777811819971705.post-1349802594384927459</id><published>2012-05-09T23:30:00.000-07:00</published><updated>2012-05-09T23:30:07.417-07:00</updated><title type="text">How to add HTML Javascript 2 Blogger template</title><content type="html">Blogger.com is a very popular and powerful online blogging platform. Blogger.com have recently introduced there new interface with lots of new features and enhancements.  Whenever there is a change in interface, users might find it difficult to find some options and tool from updated interface.&lt;br/&gt;&lt;br/&gt;If you are a blogger user , and wish to add HTML, JavaScript and CSS codes and styles to your blogger template, then you might need to find it because blogger have done some changes in there UI. Because even I face the same problem while editing the template, so I am writing this post which will help you to insert HTML,css and / or JavaScript code to your blogger template.&lt;br/&gt;&lt;br/&gt;   &lt;b&gt;How To add HTML, CSS and JavaScripts Code in Blogger template?&lt;/b&gt;&lt;ul&gt; &lt;li&gt;Go to Blogger &gt;&gt; Your Blog &gt;&gt; Template (Left menu) &gt;&gt; EDIT HTML ( Right Pane ) &gt;&gt; Proceed &lt;/li&gt; &lt;li&gt;How to add CSS &lt;ul&gt;&lt;li&gt;Search for &lt;b&gt; ]]&gt;&lt;/b:skin&gt;&lt;/b&gt; With (CTRL+F).&lt;/li&gt;      &lt;li&gt;After you find &lt;b&gt;]]&gt;&lt;/b:skin&gt;&lt;/b&gt; just above it paste the css style that you wish to apply to your pages.&lt;/li&gt;      &lt;li&gt;Save your template by pressing &lt;b&gt;Save Template Button&lt;/b&gt;.&lt;/li&gt;      &lt;li&gt;Now you can use these css styles in your posts.&lt;/li&gt;       &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;How to add JavaScript file&lt;ul&gt;&lt;li&gt;Search for &lt;b&gt; &lt; / head &gt;  &lt;/b&gt; With (CTRL+F).&lt;/li&gt;      &lt;li&gt;After you find &lt;b&gt; &lt; / head &gt; &lt;/b&gt; just above it paste the following code to add external JavaScript file.&lt;/li&gt;      &lt;li&gt;&lt;code&gt;&lt;script src="../../ui/jquery.ui.core.js"&gt;&lt;/script&gt;&lt;/code&gt;&lt;/li&gt;      &lt;li&gt;Save your template by pressing &lt;b&gt;Save Template Button&lt;/b&gt;.&lt;/li&gt;       &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;How to add custom HTML&lt;ul&gt;&lt;li&gt;Search for &lt;b&gt; &lt; html &gt;  &lt;/b&gt; With (CTRL+F).&lt;/li&gt;      &lt;li&gt;After you find &lt;b&gt; &lt; / html &gt; &lt;/b&gt;, you can add your HTML code any where. But it may disturb the original template. So do it carefully. Or use the HTML widged.&lt;/li&gt;      &lt;li&gt;Save your template by pressing &lt;b&gt;Save Template Button&lt;/b&gt;.&lt;/li&gt;       &lt;/ul&gt; &lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2063777811819971705-1349802594384927459?l=php-tuts.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/BEu6MDVaHlQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://php-tuts.blogspot.com/feeds/1349802594384927459/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://php-tuts.blogspot.com/2012/05/how-to-add-html-javascript-2-blogger.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2063777811819971705/posts/default/1349802594384927459" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2063777811819971705/posts/default/1349802594384927459" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/blogspot/php-tutorials/~3/BEu6MDVaHlQ/how-to-add-html-javascript-2-blogger.html" title="How to add HTML Javascript 2 Blogger template" /><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><feedburner:origLink>http://php-tuts.blogspot.com/2012/05/how-to-add-html-javascript-2-blogger.html</feedburner:origLink></entry><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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/QgPGqjklYAE" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/QgPGqjklYAE/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><feedburner:origLink>http://php-tuts.blogspot.com/2011/07/easy-jquery-form-validator-absolute.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/KwS5j_qJndg" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/KwS5j_qJndg/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><feedburner:origLink>http://php-tuts.blogspot.com/2011/02/what-is-polymorphism-in-php.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/BtlmwzeH7vg" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/BtlmwzeH7vg/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><feedburner:origLink>http://php-tuts.blogspot.com/2011/02/what-is-meant-by-session-clustering.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/fSy0w9c5D7Y" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/fSy0w9c5D7Y/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><feedburner:origLink>http://php-tuts.blogspot.com/2011/02/what-are-most-common-caching-policy.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/UpCuBjCo0bI" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/UpCuBjCo0bI/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><feedburner:origLink>http://php-tuts.blogspot.com/2011/02/what-are-database-space-saving.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/k0rE-MA4acU" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/k0rE-MA4acU/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><feedburner:origLink>http://php-tuts.blogspot.com/2011/01/common-php-questions-and-answers.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/zX3OgRne_PY" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/zX3OgRne_PY/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><feedburner:origLink>http://php-tuts.blogspot.com/2009/12/different-result-found-in-google-search.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/_CFgfQttG68" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/_CFgfQttG68/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><feedburner:origLink>http://php-tuts.blogspot.com/2009/11/adjacency-list-model-and-nested-set.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/OvaVPxAJqcE" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/OvaVPxAJqcE/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><feedburner:origLink>http://php-tuts.blogspot.com/2009/04/zend-framework-captcha-sample-image.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/7uVmvxh2pTE" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/7uVmvxh2pTE/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><feedburner:origLink>http://php-tuts.blogspot.com/2009/05/new-phpini-directives-in-php5.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/egn75NiGYNI" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/egn75NiGYNI/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><feedburner:origLink>http://php-tuts.blogspot.com/2009/04/php-functions-in-details-tricks-n-tips.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/vkZzVQSz9wc" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/vkZzVQSz9wc/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><feedburner:origLink>http://php-tuts.blogspot.com/2009/04/developing-secured-web-application-with.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/ldpz0UgUi9Y" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/ldpz0UgUi9Y/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><feedburner:origLink>http://php-tuts.blogspot.com/2009/05/standard-php-library-extension-download.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/xoJopsrjfXY" height="1" width="1"/&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="2 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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/xoJopsrjfXY/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>2</thr:total><feedburner:origLink>http://php-tuts.blogspot.com/2009/05/language-construct-in-php-echo-print.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/MKnIAZBC5Nc" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/MKnIAZBC5Nc/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><feedburner:origLink>http://php-tuts.blogspot.com/2009/05/simple-file-handling-functions-faster.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/hqsAmNVor1U" height="1" width="1"/&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="3 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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/hqsAmNVor1U/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>3</thr:total><feedburner:origLink>http://php-tuts.blogspot.com/2009/05/how-to-avoid-direct-access-to-file.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/kiX04-4C0Tk" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/kiX04-4C0Tk/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><feedburner:origLink>http://php-tuts.blogspot.com/2009/05/clearstatcache-filesystem-function.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/AyWRGpEX8S4" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/AyWRGpEX8S4/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><feedburner:origLink>http://php-tuts.blogspot.com/2009/05/programming-tips-tricks-performance.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/8sIBPqNxJN4" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/8sIBPqNxJN4/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><feedburner:origLink>http://php-tuts.blogspot.com/2009/05/predefined-constants-phpversion-os-eol.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/BB4Dvnphveg" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/BB4Dvnphveg/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><feedburner:origLink>http://php-tuts.blogspot.com/2009/04/custom-error-handler-sample-example.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/bmTJ6xzenNo" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/bmTJ6xzenNo/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><feedburner:origLink>http://php-tuts.blogspot.com/2009/04/oops-things-to-remember-about-class.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/exXbew_6CH4" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/exXbew_6CH4/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><feedburner:origLink>http://php-tuts.blogspot.com/2009/05/setcookie-tutorial-syntax-login-example.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/jgv9ws_dLZg" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/jgv9ws_dLZg/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><feedburner:origLink>http://php-tuts.blogspot.com/2009/04/regular-expression-tutorial-basic-rules.html</feedburner:origLink></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;&lt;img src="http://feeds.feedburner.com/~r/blogspot/php-tutorials/~4/daWa-TwsV5o" height="1" width="1"/&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://feedproxy.google.com/~r/blogspot/php-tutorials/~3/daWa-TwsV5o/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><feedburner:origLink>http://php-tuts.blogspot.com/2009/04/type-hinting-objects-as-function.html</feedburner:origLink></entry></feed>

