tag:blogger.com,1999:blog-72806969716275246292024-03-02T09:29:08.837-08:00PHP website DevelopmentEffective Way To Learn Website DevelopmentHD Photo Gallaryhttp://www.blogger.com/profile/00201014708175079291noreply@blogger.comBlogger1421125tag:blogger.com,1999:blog-7280696971627524629.post-68759021609723291532013-06-18T22:57:00.002-07:002013-06-18T22:57:33.960-07:00Weird properties of PHP's lexer and parser<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="margin-bottom: 5px; margin-top: 5px; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">There are (as of PHP 5.3.0) only two tokens which represent a single character:</span></div>
<ul style="list-style-image: initial; list-style-position: outside; margin: 10px 2em; padding: 0px;">
<li style="margin: 0px; padding: 0px;"><span style="font-family: Trebuchet MS, sans-serif;">T_NAMESPACE_SEPARATOR: <code>\</code></span></li>
<li style="margin: 0px; padding: 0px;"><span style="font-family: Trebuchet MS, sans-serif;">T_CURLY_OPEN: <code>{</code></span><ul style="list-style: disc outside; margin: 10px 2em; padding: 0px;">
<li style="margin: 0px; padding: 0px;"><span style="font-family: Trebuchet MS, sans-serif;">This only occurs inside of interpolated strings, e.g. "{$foo}" lexes to: <code>'"' T_CURLY_OPEN T_VARIABLE '}' '"'</code></span></li>
</ul>
</li>
<li style="margin: 0px; padding: 0px;"><span style="font-family: Trebuchet MS, sans-serif;"><del>Technically, there is a third, T_BAD_CHARACTER, but it is non-specific.</del> No longer true according to one of the php devs</span></li>
</ul>
<div style="margin-bottom: 5px; margin-top: 5px; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">There are two items in the parser which, instead of being unspecified and generating a generic parse error, exist only to throw a special parse error:</span></div>
<ul style="list-style-image: initial; list-style-position: outside; margin: 10px 2em; padding: 0px;">
<li style="margin: 0px; padding: 0px;"><span style="font-family: Trebuchet MS, sans-serif;">using <code>isset()</code> with something other than a variable</span></li>
<li style="margin: 0px; padding: 0px;"><span style="font-family: Trebuchet MS, sans-serif;">using <code>__halt_compiler()</code> anywhere other than the global scope (e.g., inside a function, conditional or loop)</span></li>
</ul>
<div style="margin-bottom: 5px; margin-top: 5px; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">(<a href="http://www.dereleased.com/2013/01/29/adventures-in-parsing-phps-implicit-semicolon-before-every-close-tag/" style="color: #336699; text-decoration: none;">Shameless blog plug on this one</a>) The closing tag <code>?></code> is implicitly converted to a semicolon. The opening tag consumes one character of whitepace (or two in case of windows newlines) after the literal tag, but is otherwise completely ignored by the parser. Thus, the following code is syntactically correct:</span></div>
<pre style="margin: 10px; padding: 0px;"><code><span style="font-family: Trebuchet MS, sans-serif;">for ( $i = 0 ?><?php $i < 10 ?><?php ++$i ) echo "$i\n" ?>
</span></code></pre>
<div style="margin-bottom: 5px; margin-top: 5px; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">And it lexes (after the first round transform) to</span></div>
<pre style="margin: 10px; padding: 0px;"><code><span style="font-family: Trebuchet MS, sans-serif;">T_FOR '(' T_VARIABLE '=' T_LNUMBER ';' T_VARIABLE '<' T_LNUMBER ';'
T_INC T_VARIABLE ')' T_ECHO '"' T_VARIABLE
T_ENCAPSED_AND_WHITESPACE '"' ';'
</span></code></pre>
<div style="margin-bottom: 5px; margin-top: 5px; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">The next several relate to variable interpolation syntax. For these, it helps to know the difference between a statement (<code>if</code>, <code>for</code>, <code>while</code>, etc) and an expression (something with a value, like a variable, object lookup, function call, etc).</span></div>
<ol style="list-style-image: initial; list-style-position: outside; margin: 10px 2em 10px 3em; padding: 0px;">
<li style="margin: 0px; padding: 0px;"><span style="font-family: Trebuchet MS, sans-serif;">If you interpolate an array with a single element lookup and no braces, non-identifier-non-whitespace chars will be parsed as single-character tokens until either a whitespace character or closing bracket is encountered.</span><ul style="list-style: disc outside; margin: 10px 2em; padding: 0px;">
<li style="margin: 0px; padding: 0px;"><span style="font-family: Trebuchet MS, sans-serif;">e.g., "$foo["bar$$foo]" lexes to <code>'"' T_VARIABLE '[' '"' T_STRING '$' '$' T_STRING ']' '"'</code></span></li>
</ul>
</li>
<li style="margin: 0px; padding: 0px;"><span style="font-family: Trebuchet MS, sans-serif;">In a similar scenario to the above, if you do use a space inside the braces, you will get an extra, empty<code>T_ENCAPSED_AND_WHITESPACE</code> token.</span><ul style="list-style: disc outside; margin: 10px 2em; padding: 0px;">
<li style="margin: 0px; padding: 0px;"><span style="font-family: Trebuchet MS, sans-serif;">e.g., "$foo[ whatever here" lexes to <code>'"' T_VARIABLE '[' T_ENCAPSED_AND_WHITESPACE T_ENCAPSED_AND_WHITESPACE '"'</code></span></li>
</ul>
</li>
<li style="margin: 0px; padding: 0px;"><span style="font-family: Trebuchet MS, sans-serif;">In the midst of complex interpolation, if you are in one of the constructs that allows you to use full expressions, you can insert a closing tag (which PHP considers to be the same as a ';' and therefore bad syntax, but nevertheless), and it will be parsed as such. Furthermore, if you use an open tag, the lexer will remember that you were in the middle of an expression inside a string interpolation, although this seems like a moment of good design and implementation (or something like it).</span></li>
</ol>
<div style="margin-bottom: 5px; margin-top: 5px; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">You can nest heredocs. Seriously. Consider the following:</span></div>
<pre style="margin: 10px; padding: 0px;"><code><span style="font-family: Trebuchet MS, sans-serif;">echo <<<THONE
${<<<THTWO
test
THTWO
}
THONE;
</span></code></pre>
<div style="margin-bottom: 5px; margin-top: 5px; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">You can nest it as deep as you want, which is <del>terrible</del> (edit: a terrible thing to do), but what is hilarious is that, while the actual PHP interpreter handles this scenario correctly, the PHP userland tokenizer, <a href="http://php.net/token-get-all" style="color: #336699; text-decoration: none;"><code>token_get_all()</code></a>, cannot handle it, and parses the remainder of the source after the innermost heredoc to be one long interpolated string (edit: according to a person on the php dev team, this is fixed in 5.5).</span></div>
<div style="margin-bottom: 5px; margin-top: 5px; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">I hope these oddities have been as amusing for you to read about here as they have been for me to discover.</span></div>
</div>
Anonymousnoreply@blogger.com6tag:blogger.com,1999:blog-7280696971627524629.post-11164015520484462422013-06-05T09:15:00.000-07:002013-06-10T05:27:14.487-07:00Making Google’s CalDAV and CardDAV APIs available for everyone<img alt="Author Photo" height="80" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirCM6dfpeI5hde5wjLWErNSvbN3xFF-tkOvqSLgE1Bn-9dr7Kf3LcHqfv7jDLwzBHnRCmOe1DXmjCiiVrIyVQRHHTMzkCHAsLQ6t6CDVkxZjhxv4HCyOpbBPDK2khdj5J-PhsNeQTzYNY/s1600/piotr.jpeg" style="float: right; margin-left: 1em; text-align: right;" /><em>By Piotr Stanczyk, Tech Lead</em><br /><br />In March we announced that <a href="https://tools.ietf.org/html/rfc4791">CalDAV</a>, an open standard for accessing calendar data across the web, would become a partner-only API because it appeared that almost all the API usage was driven by a few large developers. Since that announcement, we received many requests for access to CalDAV, giving us a better understanding of developers’ use cases and causing us to revisit that decision. In response to those requests, we are <a href="https://developers.google.com/google-apps/calendar/caldav/v2/guide">keeping the CalDAV API public</a>. And in the spirit of openness, today we’re also making <a href="http://tools.ietf.org/html/rfc6352">CardDAV</a> – an open standard for accessing contact information across the web – <a href="https://developers.google.com/google-apps/carddav/">available to everyone</a> for the first time.<br /><br />Both of these APIs are getting other updates as well:<br /><ul><li>Integration with the <a href="https://code.google.com/apis/console">Google APIs Console</a>. To start using CalDAV or CardDAV in your project, just enable it in the Console.</li><li><a href="https://developers.google.com/accounts/docs/OAuth2">OAuth 2.0 authentication</a>.</li></ul>In addition, the CalDAV API now has a new endpoint: <br />https://apidata.googleusercontent.com/caldav/v2<br /><br /><br /><em>Piotr Stanczyk is the Tech Lead of the Google Calendar APIs group. His current focus is to provide next generation Calendar APIs which make developers’ lives easier. He also participates in CalConnect consortium.</em><br /><br /><em>Posted by <a href="https://google.com/+ScottKnaster">Scott Knaster</a>, Editor</em><br /><blockquote></blockquote><br /><br />Anonymousnoreply@blogger.com2Mountain View, CA, USA37.3860517 -122.083851137.2851427 -122.2452126 37.486960700000004 -121.9224896tag:blogger.com,1999:blog-7280696971627524629.post-92132690094703189802013-06-04T16:00:00.000-07:002013-06-10T05:27:14.497-07:00Hacking for change at Google<img alt="Author Picture" height="80" src="https://lh3.googleusercontent.com/-LK_dMxzl5_A/AAAAAAAAAAI/AAAAAAAFtAs/P1FstgH_xlQ/photo.jpg?sz=80" style="float: right; margin-left: 1em; text-align: right;" /><em>By Patrick Copeland, Google.org</em><br /><br /><em>Cross-posted with the <a href="http://blog.google.org/">Google.org Blog</a></em><br /><br />On June 1st and 2nd, thousands of developers from across the U.S. came together at nearly 100 different locations to participate in the first ever <a href="http://hackforchange.org/">National Day of Civic Hacking</a>. Using <a href="http://hackforchange.org/datasets">public data</a> recently released by the government on topics like crime, health and the environment, developers built new applications that help address social challenges.<br /><br /><div class="separator" style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZYrm2WG9tWv0objrIaPM4hrmj_Iq1Yy8rfPFx1Xpk9lx_n58hhrQKHAmSrFQoDb5wI11bdkf17MQhnEP_IhvPxmx4Uzz-hEHhFKYfd38_JRJhbNsJHJFzVhOcNdg_ScUEatnN7uxQaao/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="262" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZYrm2WG9tWv0objrIaPM4hrmj_Iq1Yy8rfPFx1Xpk9lx_n58hhrQKHAmSrFQoDb5wI11bdkf17MQhnEP_IhvPxmx4Uzz-hEHhFKYfd38_JRJhbNsJHJFzVhOcNdg_ScUEatnN7uxQaao/s400/2.png" width="400" /></a></div><br />At the Googleplex in Mountain View, we hosted nearly 100 developers, statisticians, data scientists, and designers, who stayed long into the night hacking together prototypes that show how data on health and the environment can be used to enrich lives. <a href="https://developers.google.com/fusiontables/">Fusion Tables</a> and <a href="https://cloud.google.com/products/">Google App Engine</a> were used to prototype, and groups relied on <a href="https://developers.google.com/bigquery/">BigQuery</a> as a workhorse to crunch the biggest datasets. Participants used Google+ Hangouts to connect with hackathons in other states and collaborated with Google Apps and platforms.<br /><br />Here are a few highlights from the hackathon that stood out as useful, visually stunning, and informative ways to use public data:<br /><ul><li><a href="http://eathealthyforless.org/">Eat Healthy for Less</a>, the winner of our Mountain View hackathon, is a mobile web application that uses the Consumer Pricing Index to suggest healthy recipes that can be made on a budget.</li><li><a href="http://dataplus.cog1.net/">Data+</a>, a reimagining of how we access data, can make exploring public datasets more intuitive and easily understandable for everyone.</li><li><a href="http://detoxic.org/">Detoxic.org</a> is a web experience and Android app that shows you toxic sites and landfills nearby that you might not know about so that you can take civic action against toxic waste.</li></ul>Many of the ideas have great potential, and we are encouraging participants to continue their work. We hope that the National Day of Civic Hacking will be a catalyst for innovation in this space, and encourage you to keep track of our tools for civic developers at <a href="http://g.co/civicdevelopers">g.co/civicdevelopers</a>.<br /><br /><div class="separator" style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEj-pKK1K05FlyguXFvtTrrIfv5ETifLT1v8XuQpn_omgCAuB6RtmWlaQw_KIbU6kj7RXB94_AxEWRe6Aqn3CToRxlcOQfCwVHWEd2gXYMWB6mlBgHQY0r-RPEFzntn2Xw2BPHrMTUTCI/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEj-pKK1K05FlyguXFvtTrrIfv5ETifLT1v8XuQpn_omgCAuB6RtmWlaQw_KIbU6kj7RXB94_AxEWRe6Aqn3CToRxlcOQfCwVHWEd2gXYMWB6mlBgHQY0r-RPEFzntn2Xw2BPHrMTUTCI/s400/1.png" width="400" /></a></div><br />Congratulations and thanks to everyone who participated!<br /><br /><br /><em><a href="http://patrickcopeland.org/">Patrick Copeland</a> is director of engineering at Google.org, where he works to build systems that leverage Google's reach to help people around the world.</em><br /><br /><em>Posted by <a href="https://profiles.google.com/u/0/105627346610764729807/about">Scott Knaster</a>, Editor</em><br /><blockquote></blockquote>Anonymousnoreply@blogger.com0Mountain View, CA, USA37.3860517 -122.083851137.2851427 -122.2452126 37.486960700000004 -121.9224896tag:blogger.com,1999:blog-7280696971627524629.post-31280328127619281662013-06-04T09:00:00.000-07:002013-06-10T05:27:14.507-07:00A classic boardwalk game rolls from your phone to your computer—using only your browser<img alt="Author Photo" height="80" src="http://4.bp.blogspot.com/-aAC65M3_vkw/Tzqz3PATGGI/AAAAAAAABCs/q9X5BVpobko/s1600/pete_lepage.jpg" style="float: right; margin-left: 1em; text-align: right;" /><em>By Pete LePage, Developer Advocate and Boardwalk King</em><br /><br /><em>Cross-posted from the <a href="http://blog.chromium.org/2013/06/a-classic-boardwalk-game-rolls-from.html">Chromium Blog</a></em><br /><br />Last week we <a href="http://chrome.blogspot.com/2013/05/roll-across-platforms-and-race-across.html">launched</a> <a href="http://g.co/rollit">Roll It</a>, a <a href="http://www.chromeexperiments.com/">Chrome Experiment</a> that links phones to computers and gets people out of their chairs and swinging. We wanted to share how we built a physical game experience with no dedicated hardware. It requires just the web, your computer and a phone.<br /><br />Here’s a look at the APIs and browser-based features we used to create it.<br /><br /><div center="" text-align:=""><div style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOzvCA5j0l6t1USwHCStIRTmTSADboxJH_qCoq-ohkT0BbsQmP5MlmNJcwgDkaZzCrYDwSDRZTRPrS2H8rq1-IJXHRdqJOoZ3w1N4M3j3k3oxwyr2YvLNixR6qsN7WOy-wTDiijsgKj_8/s1600/rollit-screenshot.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOzvCA5j0l6t1USwHCStIRTmTSADboxJH_qCoq-ohkT0BbsQmP5MlmNJcwgDkaZzCrYDwSDRZTRPrS2H8rq1-IJXHRdqJOoZ3w1N4M3j3k3oxwyr2YvLNixR6qsN7WOy-wTDiijsgKj_8/s400/rollit-screenshot.jpg" width="400" /></a></div></div><br />Roll It is a three-dimensional (3D) experience, from the swing of your phone’s <a href="http://www.html5rocks.com/en/tutorials/device/orientation/">accelerometer</a> right up to the virtual models rendered on your computer’s <a href="http://en.wikipedia.org/wiki/Canvas_element">HTML5 Canvas</a>. On the phone side, we hooked into browser events like <span style="font-family: Courier New, Courier, monospace;">DeviceOrientation</span> and <span style="font-family: Courier New, Courier, monospace;">DeviceMotion</span> to detect the speed and direction of a swing. On the computer side we rendered our scene using <a href="http://threejs.org/">Three.js</a> and plugged in <a href="http://chandlerprall.github.io/Physijs/">Physijs</a> to add physics to the ball and environment.<br /><br />To sync the phone to the computer we employed <a href="http://www.html5rocks.com/en/tutorials/websockets/basics/">WebSockets</a> which enable rapid two-way communication between devices via a central server.<br /><br />For extra stability we built our backend on <a href="https://cloud.google.com/">Google Cloud Platform</a>:<br /><ul><li>Our <a href="https://cloud.google.com/products/">Google App Engine</a> application, built in <a href="http://golang.org/">Go</a>, dynamically balances users across our relay servers.</li><li>A <a href="https://cloud.google.com/products/compute-engine">Google Compute Engine</a> server maintains game state across synced devices.</li><li><a href="https://cloud.google.com/products/cloud-storage">Google Cloud Storage</a> speedily serves up the static assets.</li></ul>We couldn’t have brought this experiment to life without a great team. The theme for Roll It was composed by <a href="http://www.shroom.biz/index.html">Mr. Tim Healey</a>. <a href="http://www.legworkstudio.com/">Legwork Studio</a> developed the interfaces and game environment, and teamed up with <a href="http://modeset.com/">Mode Set</a> for the development.<br /><br />To dig deeper into the technology behind Roll It, check out the <a href="http://www.html5rocks.com/en/tutorials/casestudies/roll-it/">HTML5 Rocks Case Study</a>, or join the team for a <a href="https://developers.google.com/events/717274144/">Google Developers Live</a> event this Friday, June 7, 2013 at 5pm GMT for an in-depth discussion.<br /><br /><br /><em><a href="https://google.com/+PeteLePage">Pete LePage</a> is a Developer Advocate on the Google Chrome team and helps developers create great web applications and mobile web experiences.</em><br /><br /><em>Posted by <a href="https://google.com/+ScottKnaster">Scott Knaster</a>, Editor</em><br /><br /><blockquote></blockquote>Anonymousnoreply@blogger.com0Mountain View, CA, USA37.3860517 -122.083851137.2851427 -122.2452126 37.486960700000004 -121.9224896tag:blogger.com,1999:blog-7280696971627524629.post-47642342824157400212013-06-03T08:03:00.002-07:002013-06-03T08:03:55.044-07:00What is Object Oriented Programming (OOP)?<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 20px; font-weight: 200; line-height: 22px; margin: 0px 0px 20px; padding: 0px;">
Introduction</h2>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Quite often I see a question in a newsgroup or forum along the lines of: What is this thing called ‘OOP’? What is so special about it? Why should I use it? How do I use it?. The person asking this type of question usually has experience of non-OO programming and wants to know the benefits of making the switch. Unfortunately most of the replies I have seen have been long on words but short on substance, full of airy-fairy, wishy-washy, meaningless phrases which are absolutely no use at all to man or beast.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Having created 1000′s of programs using non-OO languages, and another 500+ using the OO features of <a href="http://www.php.net/" style="-webkit-transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s; color: #094582; line-height: inherit; text-decoration: none; transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s;" target="_blank">PHP</a> I feel more than qualified to add my own contribution to the melting pot. According to some OO ‘purists’ I am not qualified at all as I was not taught to do things ‘their’ way and I refuse to follow ‘their’ methods. My response to that accusation is that there is no such thing as ‘only one true way’ with OOP just as there is no such thing as ‘only one true way’ with religion. People tell me that my methods are wrong, but they are making a classic mistake. My methods cannot be wrong for the simple reason that they work, and anybody with more than two brain cells to rub together will tell you that something that works cannot be wrong just as something that does not work cannot be right. My methods are not wrong, they are simply different, and sometimes it is a willingness to adopt a different approach that separates the <a href="http://www.tonymarston.net/php-mysql/code-monkey.html" style="-webkit-transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s; color: #094582; line-height: inherit; text-decoration: none; transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s;" target="_blank">code monkeys</a> from the engineers.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
One reason why some people give totally useless answers is that it was what they were taught, and they do not have the intelligence to look beyond what they were taught. Another reason is that some of the explanations about OO are rather vague and can be interpreted in several ways, and if something is open to interpretation it is also open to a great deal of mis-interpretation. If you do not believe that there is widespread confusion as to what OO is and is not then take a look at <a href="http://c2.com/cgi/wiki?NobodyAgreesOnWhatOoIs" style="-webkit-transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s; color: #094582; line-height: inherit; text-decoration: none; transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s;" target="_blank">Nobody Agrees On What OO Is</a>. Even some of the basic terminology can mean different things to different people, as explained in <a href="http://www.itmweb.com/essay550.htm" style="-webkit-transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s; color: #094582; line-height: inherit; text-decoration: none; transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s;" target="_blank">Abstraction, Encapsulation, and Information Hiding</a>. If these people cannot agree on the basic concepts of OOP, then how can they possibly agree on how those concepts may be implemented.</div>
<h2 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 20px; font-weight: 200; line-height: 22px; margin: 0px 0px 20px; padding: 0px;">
What OOP is NOT</h2>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
As a first step I shall debunk some of the answers that I have seen. In compiling the following list I picked out those descriptions which are not actually unique to OOP as those features which already exist in non-OO languages cannot be used to differentiate between the two.</div>
<h3 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 16px; font-weight: 200; line-height: 20px; margin-top: 0px; padding: 0px;">
OOP is about modeling the ‘real world’</h3>
<blockquote style="background-color: white; background-image: url(http://www.developertutorials.com/wp-content/themes/magazon-wp/assets/images/content-quote.png); background-position: 0% 5px; background-repeat: no-repeat no-repeat; border-left-style: none; color: #777777; font-family: 'Droid Sans'; font-size: 13px; font-style: italic; line-height: 20px; margin: 0px 0px 25px 40px; padding: 0px 30px 0px 50px;">
<div style="margin-bottom: 18px;">
OOP is a programming paradigm that uses abstraction to create models based on the real world. It provides for better modeling of the real world by providing a much needed improvement in domain analysis and then integration with system design.</div>
</blockquote>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Rubbish. OOP is no better at modeling the real world than any other method. Every computer program which seeks to replace a manual process is based on a conceptual software model of that process, and if the model is wrong then the software will also be wrong. The conceptual model is created as an analyst’s view of the real world, and the computer software is based solely on this conceptual model. OOP does not guarantee that the model will be better, just that the implementation of that model will be different.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
The term "abstraction" is also open to interpretation, and therefore mis-interpretation, as discussed inUnderstand what "abstraction" really means. This is why some people’s abstractions look more like the work of Picasso when what is required should look like the work of Michelangelo.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
That is why it is possible to create software that does A, B and C but it is useless to the customer as it does not also do X, Y and Z. The real world may contain X, Y and Z but the analyst did not include it in his model either because he did not spot it or because the customer failed to mention it in his Specification Of Requirements (SOR). I know because I have encountered both situations in my long career.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Not everyone agrees that direct real-world mapping is facilitated by OOP, or is even a worthy goal; <a href="http://en.wikipedia.org/wiki/Bertrand_Meyer" style="-webkit-transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s; color: #094582; line-height: inherit; text-decoration: none; transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s;" target="_blank">Bertrand Meyer</a> argues in <a href="http://en.wikipedia.org/wiki/Object-Oriented_Software_Construction" style="-webkit-transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s; color: #094582; line-height: inherit; text-decoration: none; transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s;" target="_blank">Object-Oriented Software Construction</a> that a program is not a model of the world but a model of a model of some part of the world; "Reality is a cousin twice removed".</div>
<h3 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 16px; font-weight: 200; line-height: 20px; margin-top: 0px; padding: 0px;">
OOP is about code re-use</h3>
<blockquote style="background-color: white; background-image: url(http://www.developertutorials.com/wp-content/themes/magazon-wp/assets/images/content-quote.png); background-position: 0% 5px; background-repeat: no-repeat no-repeat; border-left-style: none; color: #777777; font-family: 'Droid Sans'; font-size: 13px; font-style: italic; line-height: 20px; margin: 0px 0px 25px 40px; padding: 0px 30px 0px 50px;">
<div style="margin-bottom: 18px;">
The power of object-oriented systems lies in their promise of code reuse which will increase productivity, reduce costs and improve software quality.</div>
</blockquote>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Rubbish. This implies that code re-use is possible in OOP and not possible in non-OOP. Using OOP does not guarantee that more reusable code will be available as reusability depends on how the code is written, not the language in which it was written. It is possible to produce libraries of reusable modules in any non-OO language (I know, because I was doing just that with COBOL in 1985) just as it is possible to produce volumes of non-reusable code in any OO language.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
It does not matter on the capabilities of the language as it is possible to have the same block of code duplicated in 100 places in any language. It is also possible, in any language, to put that block of code into a reusable module and call that module from those 100 places.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
One of the early promises of OOP that I heard many years ago was that it would be possible for a software vendor to produce a library of pre-written classes, and for other developers to use these "off the shelf" classes instead of creating their own custom versions and thus "re-inventing the wheel". This dream never materialised, which just goes to prove that OOP promises much but delivers little.</div>
<h3 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 16px; font-weight: 200; line-height: 20px; margin-top: 0px; padding: 0px;">
OOP is about modularity</h3>
<blockquote style="background-color: white; background-image: url(http://www.developertutorials.com/wp-content/themes/magazon-wp/assets/images/content-quote.png); background-position: 0% 5px; background-repeat: no-repeat no-repeat; border-left-style: none; color: #777777; font-family: 'Droid Sans'; font-size: 13px; font-style: italic; line-height: 20px; margin: 0px 0px 25px 40px; padding: 0px 30px 0px 50px;">
<div style="margin-bottom: 18px;">
The source code for an object can be written and maintained independently of the source code for other objects. Once created, an object can be easily passed around inside the system.</div>
</blockquote>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Rubbish. The concept of modular programming has existed in non-OO languages for many years, so this argument cannot be used to explain why OO is supposed to be better than non-OO. Just as it is possible in any language to hold the source code for an entire application in a single file, it is just as possible, in any language, to break that source code into smaller modules so that the source code for each module can be maintained and compiled independently of all other modules.</div>
<h3 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 16px; font-weight: 200; line-height: 20px; margin-top: 0px; padding: 0px;">
OOP is about plugability</h3>
<blockquote style="background-color: white; background-image: url(http://www.developertutorials.com/wp-content/themes/magazon-wp/assets/images/content-quote.png); background-position: 0% 5px; background-repeat: no-repeat no-repeat; border-left-style: none; color: #777777; font-family: 'Droid Sans'; font-size: 13px; font-style: italic; line-height: 20px; margin: 0px 0px 25px 40px; padding: 0px 30px 0px 50px;">
<div style="margin-bottom: 18px;">
If a particular object turns out to be problematic, you can simply remove it from your application and plug in a different object as its replacement. This is analogous to fixing mechanical problems in the real world. If a bolt breaks, you replace it, not the entire machine.</div>
</blockquote>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Rubbish. This is the same as modularity where the source code for any individual module can be modified, recompiled and inserted into the application without having to touch any of the other modules.</div>
<h3 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 16px; font-weight: 200; line-height: 20px; margin-top: 0px; padding: 0px;">
OOP is about information hiding</h3>
<blockquote style="background-color: white; background-image: url(http://www.developertutorials.com/wp-content/themes/magazon-wp/assets/images/content-quote.png); background-position: 0% 5px; background-repeat: no-repeat no-repeat; border-left-style: none; color: #777777; font-family: 'Droid Sans'; font-size: 13px; font-style: italic; line-height: 20px; margin: 0px 0px 25px 40px; padding: 0px 30px 0px 50px;">
<div style="margin-bottom: 18px;">
By interacting only with an object’s methods, the details of its internal implementation remain hidden from the outside world.</div>
</blockquote>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Rubbish. In the first place OO is not about <i style="line-height: inherit;">information</i> hiding, it is about <i style="line-height: inherit;">implementation</i> hiding. In other words it is the code behind the API which is hidden from view. It is possible to use getters and setters to access the data, but even this is considered to be <a href="http://www.javaworld.com/javaworld/jw-09-2003/jw-0905-toolbox.html" style="-webkit-transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s; color: #094582; line-height: inherit; text-decoration: none; transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s;" target="_blank">evil</a> in some circles.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
In the second place implementation hiding was never one of the aims of OOP, it is merely a by-product of encapsulation. The outside world can see the method names which can be used on a object, but not the code which exists behind those method names.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
In the third place implementation hiding is not unique to OOP as I can distinctly remember in the 1980s writing applications in COBOL which interfaced with a commercial accounting package. The vendor of this package supplied us with a series of pre-compiled subroutines which we could call from our own code. We never saw the source code to any of these subroutines, we merely had a list of APIs and a description of what each API required as input and returned as output. How’s that for implementation hiding?</div>
<h3 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 16px; font-weight: 200; line-height: 20px; margin-top: 0px; padding: 0px;">
OOP is about the passing of messages.</h3>
<blockquote style="background-color: white; background-image: url(http://www.developertutorials.com/wp-content/themes/magazon-wp/assets/images/content-quote.png); background-position: 0% 5px; background-repeat: no-repeat no-repeat; border-left-style: none; color: #777777; font-family: 'Droid Sans'; font-size: 13px; font-style: italic; line-height: 20px; margin: 0px 0px 25px 40px; padding: 0px 30px 0px 50px;">
<div style="margin-bottom: 18px;">
Message passing is the process by which an object sends data to another object or asks the other object to invoke a method.</div>
</blockquote>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Rubbish. The way that an object’s method is invoked in an OO language is identical to the way in which a function or procedure in a non-OO language is invoked. If the language supports both non-OO functions and object methods (as PHP does) the method of invocation is called "calling", not "message passing". In fact in some languages it is necessary to specify the word "call" when invoking a subroutine.</div>
<pre style="background-color: white; color: #666666; font-family: monospace, monospace; font-size: 13px; line-height: 22px; white-space: pre-wrap; word-wrap: break-word;">non-OO: $result = function(arg1, arg2, ...)
OO: $result = $object->function(arg1, arg2, ...)</pre>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
The result of each invocation is exactly the same – the caller is suspended while control is passed to the callee, and control is not returned to the caller until the callee has finished.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
I have worked with messaging software in the past and I can tell you quite categorically that they are completely different:</div>
<ul style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; list-style: none outside; margin: 0px 0px 18px; padding: 0px;">
<li>In the first place they allow messages to be passed from one <i style="line-height: inherit;">process</i> to another, not one <i style="line-height: inherit;">module</i> to another in the <i style="line-height: inherit;">same process</i>. The only exception I have seen to this was in a language which supported the creation of non-modal forms in which it was possible for one non-modal form to send a message to another non-modal form within the same application instance.</li>
<li>In the second place their behaviour is totally different:<br /><br /><ul style="list-style: none outside; margin: 0px; padding: 0px;">
<li>They are are asynchronous, which means that after the caller drops a message into the message queue the caller can continue processing and does not have to wait until the callee returns control. E-mail is a classic example of such a messaging system.</li>
<li>The message queue may be able to contain any number of messages from any number of processes, and the receiving process picks out one message from the front of the queue, processes it, then looks for the next message.</li>
<li>The message may signify that an acknowledgement be sent back to the caller as soon as it has been received, or it may require a more elaborate result set to be returned after it has been processed.</li>
<li>In either case the message originator must contain the necessary code to deal with the acknowledgement and/or the result, which is in addition to the code which sends the message.</li>
</ul>
<div style="line-height: inherit; margin-bottom: 18px;">
</div>
</li>
</ul>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
As you can see the mechanics of activating a method in an object is <i style="line-height: inherit;">exactly the same as</i> activating a non-OO function and <i style="line-height: inherit;">nothing like</i> passing a message in a messaging system.</div>
<h3 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 16px; font-weight: 200; line-height: 20px; margin-top: 0px; padding: 0px;">
OOP is about separation of responsibilities.</h3>
<blockquote style="background-color: white; background-image: url(http://www.developertutorials.com/wp-content/themes/magazon-wp/assets/images/content-quote.png); background-position: 0% 5px; background-repeat: no-repeat no-repeat; border-left-style: none; color: #777777; font-family: 'Droid Sans'; font-size: 13px; font-style: italic; line-height: 20px; margin: 0px 0px 25px 40px; padding: 0px 30px 0px 50px;">
<div style="margin-bottom: 18px;">
Each object can be viewed as an independent little machine with a distinct role or responsibility.</div>
</blockquote>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Rubbish. It depends entirely on how the module was written, and not the language in which it was written. It is possible to write independent modules in a procedural language such as COBOL, just as it is possible to write non-independent modules in an OO language.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
The problem with "separation of responsibilities" is that different people have a different interpretation as to what it actually means. To some people the database operations such as SELECT, INSERT, UPDATE and DELETE require their own objects whereas others put them all together in a single data access object (DAO). Some programmers may have a separate DAO for each table in the database while others may have a single DAO which can deal with any and all database tables. Before you can separate any responsibilities you must first identify what those responsibilities are, and this is a design decision which is totally separate from the language in which the design is ultimately implemented.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
In all my many years of experience the only project that I have ever been involved in which failed to be implemented due to "technical difficulties" was one where the system architects were OO "experts" who knew everything about this "separation of responsibilities". They designed a system around design patterns which had a different module for each responsibility which resulted in at least ten layers of code between the user and the database. This made the creation of new components far more complicated and convoluted than it need be, and it made testing and debugging an absolute nightmare. The result was far too expensive for the client, both in time and money, so he pulled the plug on the whole project and cut his losses. A pair of components which took 10 days to build using these "new fangled" OO techniques took me less than an hour to build using my "old fashioned" non-OO methods. So much for the superiority of OO.</div>
<h3 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 16px; font-weight: 200; line-height: 20px; margin-top: 0px; padding: 0px;">
OOP is easier to learn.</h3>
<blockquote style="background-color: white; background-image: url(http://www.developertutorials.com/wp-content/themes/magazon-wp/assets/images/content-quote.png); background-position: 0% 5px; background-repeat: no-repeat no-repeat; border-left-style: none; color: #777777; font-family: 'Droid Sans'; font-size: 13px; font-style: italic; line-height: 20px; margin: 0px 0px 25px 40px; padding: 0px 30px 0px 50px;">
<div style="margin-bottom: 18px;">
OOP is easier to learn for those new to computer programming than previous approaches, and its approach is often simpler to develop and to maintain, lending itself to more direct analysis, coding, and understanding of complex situations and procedures than other programming methods.</div>
</blockquote>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Rubbish. This is just marketing hype. Every new language/tool/paradigm is supposed to be better than everything else, but it rarely is. It is not what you use but how you use it that counts, and I have personally witnessed where an "old" language, when used by competent programmers, regularly out performed a "new" language which was advertised as being more productive by several orders of magnitude.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
A person’s ability to learn something is often limited by the quality of the teachers or teaching materials, and I’m afraid that too much of what is being taught is too complicated, too inefficient, and more likely to lead to project failures than successes. Too often the teachers insist that there is "only one way" to do OOP, and that is where I most strongly disagree. I have successfully migrated to OOP by ignoring all these so-called experts and drawing on my years of experience with non-OO languages.</div>
<hr class="half" style="background-color: white; border-bottom-width: 0px; border-color: rgb(221, 221, 221); border-left-width: 0px; border-right-width: 0px; border-style: solid; clear: both; color: #666666; font-family: 'Droid Sans'; font-size: 13px; height: 0px; line-height: 22px; margin: 12px 0px 18px; padding: 0px;" />
<br style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px;" />
<span style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px;">As you can see, the above descriptions are either too vague or not specific to OOP, so they cannot be used as distinguishing features.</span><br />
<h2 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 20px; font-weight: 200; line-height: 22px; margin: 0px 0px 20px; padding: 0px;">
What is an Object Oriented language?</h2>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
A computer language can be aid to be Object Oriented if it provides support for the following:</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
</div>
<table border="1" cellpadding="3" cellspacing="0" style="background-color: white; border-collapse: collapse; border-spacing: 0px; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px;"><tbody>
<tr><td style="border: none; color: #333333; font-size: 12px; line-height: 18px; padding: 9px 10px; vertical-align: top;">Class</td><td style="border: none; color: #333333; font-size: 12px; line-height: 18px; padding: 9px 10px; vertical-align: top;">A class is a blueprint, or prototype, that defines the variables and the methods common to all objects of a certain kind.</td></tr>
<tr style="background-color: #f9f9f9; background-position: initial initial; background-repeat: initial initial;"><td style="border: none; color: #333333; font-size: 12px; line-height: 18px; padding: 9px 10px; vertical-align: top;">Object</td><td style="border: none; color: #333333; font-size: 12px; line-height: 18px; padding: 9px 10px; vertical-align: top;">An instance of a class. A class must be instantiated into an object before it can be used in the software. More than one instance of the same class can be in existence at any one time.</td></tr>
<tr><td style="border: none; color: #333333; font-size: 12px; line-height: 18px; padding: 9px 10px; vertical-align: top;">Encapsulation</td><td style="border: none; color: #333333; font-size: 12px; line-height: 18px; padding: 9px 10px; vertical-align: top;">The act of placing data and the operations that perform on that data in the same class. The class then becomes the ‘capsule’ or container for the data and operations.</td></tr>
<tr style="background-color: #f9f9f9; background-position: initial initial; background-repeat: initial initial;"><td style="border: none; color: #333333; font-size: 12px; line-height: 18px; padding: 9px 10px; vertical-align: top;">Inheritance</td><td style="border: none; color: #333333; font-size: 12px; line-height: 18px; padding: 9px 10px; vertical-align: top;">The reuse of base classes (superclasses) to form derived classes (subclasses). Methods and properties defined in the superclass are automatically shared by any subclass.</td></tr>
<tr><td style="border: none; color: #333333; font-size: 12px; line-height: 18px; padding: 9px 10px; vertical-align: top;">Polymorphism</td><td style="border: none; color: #333333; font-size: 12px; line-height: 18px; padding: 9px 10px; vertical-align: top;">Same interface, different implementation. The ability to substitute one class for another. This means that different classes may contain the same method names, but the result which is returned by each method will be different as the code behind each method (the implementation) is different in each class.</td></tr>
</tbody></table>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
A class defines (encapsulates) both the properties (data) of an entity and the methods (functions) which may act upon those properties. Neither properties or methods which can be applied to that entity should exist outside of that class definition.</div>
<h2 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 20px; font-weight: 200; line-height: 22px; margin: 0px 0px 20px; padding: 0px;">
What OOP is</h2>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
This is a lot simpler than some people would like you to believe. They like to use the more complicated definitions because it makes them sound more intelligent than they really are. Here is the real definition:</div>
<blockquote style="background-color: white; background-image: url(http://www.developertutorials.com/wp-content/themes/magazon-wp/assets/images/content-quote.png); background-position: 0% 5px; background-repeat: no-repeat no-repeat; border-left-style: none; color: #777777; font-family: 'Droid Sans'; font-size: 13px; font-style: italic; line-height: 20px; margin: 0px 0px 25px 40px; padding: 0px 30px 0px 50px;">
Object Oriented Programming is programming which is oriented around objects, thus taking advantage of Encapsulation, Polymorphism, and Inheritance to increase code reuse and decrease code maintenance.<br />
<div style="margin-bottom: 18px;">
</div>
</blockquote>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
</div>
<h2 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 20px; font-weight: 200; line-height: 22px; margin: 0px 0px 20px; padding: 0px;">
The difference between OOP and non-OOP</h2>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
A better way of trying to explain the differences between non-OO and OO programming is to actual examples.</div>
<h3 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 16px; font-weight: 200; line-height: 20px; margin-top: 0px; padding: 0px;">
They are defined differently</h3>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
A function is defined as a self-contained block of code. Each function name "fName" must be unique within the application.</div>
<pre style="background-color: white; color: #666666; font-family: monospace, monospace; font-size: 13px; line-height: 22px; white-space: pre-wrap; word-wrap: break-word;">function fName (<span class="default">$arg1</span>, <span class="default">$arg2</span>)
<span class="comment">// function description</span>
{
....
return <span class="default">$result</span>;
} <span class="comment">// fName</span>
</pre>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
A class method is defined within the boundaries of a class definition. Each class name "cName" must be unique within the application. Each class may contain any number of functions (also known as "methods"), and the function name "fName" must be unique within the class but need not be unique within the application.</div>
<pre style="background-color: white; color: #666666; font-family: monospace, monospace; font-size: 13px; line-height: 22px; white-space: pre-wrap; word-wrap: break-word;">class cName
{
function fName (<span class="default">$arg1</span>, <span class="default">$arg2</span>)
<span class="comment">// function description</span>
{
....
return <span class="default">$result</span>;
} <span class="comment">// fName</span>
} <span class="comment">// cName</span>
</pre>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
</div>
<h3 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 16px; font-weight: 200; line-height: 20px; margin-top: 0px; padding: 0px;">
They are accessed differently</h3>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
It is important to note that neither a function nor a class can be accessed until the function/class definition has been loaded.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Calling a function is very straightforward:</div>
<pre style="background-color: white; color: #666666; font-family: monospace, monospace; font-size: 13px; line-height: 22px; white-space: pre-wrap; word-wrap: break-word;"><span class="default">$result</span> = fName(<span class="default">$arg1</span>, <span class="default">$arg2</span>);</pre>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Calling a class method is not so straightforward. First it is necessary to create an instance of the class (an object), then to access the function (method) name through the object. The object name must be unique within the application.</div>
<pre style="background-color: white; color: #666666; font-family: monospace, monospace; font-size: 13px; line-height: 22px; white-space: pre-wrap; word-wrap: break-word;"><span class="default">$object</span> = new cName;
<span class="default">$result</span> = <span class="default">$object</span>->fName(<span class="default">$arg1</span>, <span class="default">$arg2</span>);</pre>
<h3 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 16px; font-weight: 200; line-height: 20px; margin-top: 0px; padding: 0px;">
They have different numbers of working copies</h3>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
A function does not have to be instantiated before it can be accessed, therefore only one copy (or instance) is said to exist at any one time.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
A class method can only be accessed after it has been instantiated into an object, and it is possible to create multiple instances (objects) of the same class with different object names.</div>
<pre style="background-color: white; color: #666666; font-family: monospace, monospace; font-size: 13px; line-height: 22px; white-space: pre-wrap; word-wrap: break-word;"><span class="default">$object1</span> = new cName;
<span class="default">$object2</span> = new cName;
<span class="default">$object3</span> = new cName; </pre>
<h3 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 16px; font-weight: 200; line-height: 20px; margin-top: 0px; padding: 0px;">
They have different numbers of entry points</h3>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
A function has only a single point of entry, and that is the function name itself.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
An object has multiple points of entry, one for each method name.</div>
<h3 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 16px; font-weight: 200; line-height: 20px; margin-top: 0px; padding: 0px;">
They have different methods of maintaining state</h3>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
A function by default does not have state, by which I mean that each<br />
<br />
time that it is called it is treated as a fresh invocation and not a continuation of any previous invocation.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
An object does have state, by which I mean that each time an object’s method is called it acts upon the object’s state as it was after the previous method call.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
It is possible for both a function and a class method to use local variables, and they both operate in the same way. This means that the local variables do not exist outside the scope of the function or class method, and any values placed in them do not persist between invocations.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
It is possible for a function to remember values between different invocations by declaring a variable as <code style="font-family: monospace, monospace; font-size: 1em; white-space: pre-wrap; word-wrap: break-word;">static</code>, as in the following example:</div>
<pre style="background-color: white; color: #666666; font-family: monospace, monospace; font-size: 13px; line-height: 22px; white-space: pre-wrap; word-wrap: break-word;">function count () {
static <span class="default">$count</span> = <span class="string">0</span>;
<span class="default">$count</span>++;
return <span class="default">$count</span>;
}</pre>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Each time this function is called it will return a value that is one greater than the previous call. Without the keyword <code style="font-family: monospace, monospace; font-size: 1em; white-space: pre-wrap; word-wrap: break-word;">static</code> it would always return the value ’1′.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Class variables which need to persist outside of a function (method) are declared at class level, as follows:</div>
<pre style="background-color: white; color: #666666; font-family: monospace, monospace; font-size: 13px; line-height: 22px; white-space: pre-wrap; word-wrap: break-word;">class calculator
{
<span class="comment">// define class properties (member variables)</span>
var <span class="default">$value</span>;
<span class="comment">// define class methods</span>
function setValue (<span class="default">$value</span>)
{
<span class="default">$this</span>->value = <span class="default">$value</span>;
return;
} <span class="comment">// setValue</span>
function getValue ()
<span class="comment">// function description</span>
{
return <span class="default">$this</span>->value;
} <span class="comment">// setValue</span>
function add (<span class="default">$value</span>)
<span class="comment">// function description</span>
{
<span class="default">$this</span>->value = <span class="default">$this</span>->value + <span class="default">$value</span>;
return <span class="default">$this</span>->value;
} <span class="comment">// setValue</span>
function subtract (<span class="default">$value</span>)
<span class="comment">// function description</span>
{
<span class="default">$this</span>->value = <span class="default">$this</span>->value - <span class="default">$value</span>;
return <span class="default">$this</span>->value;
} <span class="comment">// setValue</span>
} <span class="comment">// cName</span>
</pre>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Note that all class/object variables are referenced with the prefix <code style="font-family: monospace, monospace; font-size: 1em; white-space: pre-wrap; word-wrap: break-word;">$this-></code> as in <code style="font-family: monospace, monospace; font-size: 1em; white-space: pre-wrap; word-wrap: break-word;">$this->varname</code>. Any variable which is referenced without this keyword, as in <code style="font-family: monospace, monospace; font-size: 1em; white-space: pre-wrap; word-wrap: break-word;">$varname</code>, is treated as a local variable.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Note also that each instance of the class (object) maintains its own set of variables, so the contents of one object are totally independent of the contents of another object, even it is from the same class.</div>
<h2 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 20px; font-weight: 200; line-height: 22px; margin: 0px 0px 20px; padding: 0px;">
Practical Examples</h2>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Here are some practical examples which demonstrate Encapsulation, Inheritance and Polymorphism.</div>
<h3 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 16px; font-weight: 200; line-height: 20px; margin-top: 0px; padding: 0px;">
Encapsulation</h3>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
</div>
<table border="1" cellpadding="3" cellspacing="0" style="background-color: white; border-collapse: collapse; border-spacing: 0px; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px;"><colgroup><col width="100"></col></colgroup><tbody>
<tr><td style="border: none; color: #333333; font-size: 12px; line-height: 18px; padding: 9px 10px; vertical-align: top;">Encapsulation</td><td style="border: none; color: #333333; font-size: 12px; line-height: 18px; padding: 9px 10px; vertical-align: top;">The act of placing data and the operations that perform on that data in the same class. The class then becomes the ‘capsule’ or container for the data and operations.</td></tr>
</tbody></table>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Every application deals with a number of different entities or "things", such as "customer" "product" and "invoice", so it is common practice to create a different class for each of these entities. At runtime the software will create one or more objects from each class definition, and when it wants to do something with one of these entities it will do so by calling the relevant method on the relevant object.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
The data held within each object at runtime cannot remain in memory for ever, so it is written out to a persistent data store (a database) with a separate table for each entity. There are only four basic operations which can be performed on a database table (Create, Read, Update, Delete) so I shall start by creating a method for each one.</div>
<pre style="background-color: white; color: #666666; font-family: monospace, monospace; font-size: 13px; line-height: 22px; white-space: pre-wrap; word-wrap: break-word;">class entity1
{
<span class="comment">// class properties</span>
var <span class="default">$dbname</span>; <span class="comment">// database name</span>
var <span class="default">$errors</span> = array(); <span class="comment">// array of error messages, indexed by field name</span>
var <span class="default">$fieldarray</span>; <span class="comment">// associative array of name=value pairs</span>
var <span class="default">$fieldspec</span>; <span class="comment">// array of field specifications</span>
var <span class="default">$numrows</span>; <span class="comment">// number of database rows affected</span>
var <span class="default">$primary_key</span>; <span class="comment">// array of field names which make up the primary key</span>
var <span class="default">$tablename</span>; <span class="comment">// table name</span>
<span class="comment">// class methods</span>
function entity1 ()
<span class="comment">// constructor</span>
{
<span class="default">$this</span>->tablename = <span class="string">'entity1'</span>;
<span class="default">$this</span>->dbname = <span class="string">'foobar'</span>;
<span class="default">$this</span>->fieldlist = array(<span class="string">'column1'</span>, <span class="string">'column2'</span>, <span class="string">'column3'</span>, <span class="string">'column4'</span>);
<span class="default">$this</span>->primary_key = array(<span class="string">'column1'</span>);
} <span class="comment">// entity1</span>
<span class="comment">// class methods</span>
function getData (<span class="default">$where</span>)
<span class="comment">// read data from the database which satisfies the selection criteria in $where</span>
{
....
return <span class="default">$this</span>->fieldarray;
} <span class="comment">// getData</span>
function insertRecord (<span class="default">$fieldarray</span>)
<span class="comment">// create a database record using the contents of $fieldarray</span>
{
....
return <span class="default">$this</span>->fieldarray;
} <span class="comment">// insertRecord</span>
function updateRecord (<span class="default">$fieldarray</span>)
<span class="comment">// update a database record using the contents of $fieldarray</span>
{
....
return <span class="default">$this</span>->fieldarray;
} <span class="comment">// updateRecord</span>
function deleteRecord (<span class="default">$fieldarray</span>)
<span class="comment">// delete a database record identified in $fieldarray</span>
{
....
return <span class="default">$this</span>->fieldarray;
} <span class="comment">// deleteRecord</span>
} <span class="comment">// entity1</span>
</pre>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Please note the following:</div>
<ul style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; list-style: none outside; margin: 0px 0px 18px; padding: 0px;">
<li>The class constructor identifies the physical characteristics of this database table, that which makes it unique from all other database tables. The contents of the class constructor are performed automatically when the class is instantiated into an object.</li>
<li>All the table data is held in a single array of fields rather than a separate variable for each field. For a detailed explanation as to why I choose this method please read Why don’t you use GETTERS and SETTERS?</li>
<li>I have not bothered including the actual code within each method as it there is too much of it. It you really want to see the code that I use then you can download it, either for my small sample application, or my full development framework.</li>
<li>There are actually many more methods than the four mentioned, but these are enough to begin with.</li>
</ul>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Each of these classes therefore acts as a ‘capsule’ which contains<br />
<br />
both the data for an entity and the operations which can be performed<br />
<br />
upon that data. This is ‘encapsulation’.</div>
<h3 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 16px; font-weight: 200; line-height: 20px; margin-top: 0px; padding: 0px;">
Inheritance</h3>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
</div>
<table border="1" cellpadding="3" cellspacing="0" style="background-color: white; border-collapse: collapse; border-spacing: 0px; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px;"><colgroup><col width="100"></col></colgroup><tbody>
<tr><td style="border: none; color: #333333; font-size: 12px; line-height: 18px; padding: 9px 10px; vertical-align: top;">Inheritance</td><td style="border: none; color: #333333; font-size: 12px; line-height: 18px; padding: 9px 10px; vertical-align: top;">The reuse of base classes (superclasses) to form derived classes (subclasses). Methods and properties defined in the superclass are automatically shared by any subclass.</td></tr>
</tbody></table>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
After writing and testing a class to deal with ‘entity1′ I copied it and made it work for ‘entity2′. I then compared the two classes to see what code was common and could be shared, and what code was unique and could not be shared. I then transferred all the common code into a separate class known as a ‘superclass’.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Firstly, to create the superclass, I changed the class name and the constructor to the following:</div>
<pre style="background-color: white; color: #666666; font-family: monospace, monospace; font-size: 13px; line-height: 22px; white-space: pre-wrap; word-wrap: break-word;">class default
{
<span class="comment">// class properties</span>
....
<span class="comment">// class methods</span>
function default ()
<span class="comment">// constructor</span>
{
<span class="default">$this</span>->tablename = <span class="string">'unknown'</span>;
<span class="default">$this</span>->dbname = <span class="string">'unknown'</span>;
<span class="default">$this</span>->fieldlist = array();
<span class="default">$this</span>->primary_key = array();
} <span class="comment">// default</span>
<span class="comment">// class methods</span>
function getData (<span class="default">$where</span>)
....
function insertRecord (<span class="default">$fieldarray</span>)
....
function updateRecord (<span class="default">$fieldarray</span>)
....
function deleteRecord (<span class="default">$fieldarray</span>)
....
} <span class="comment">// default</span>
</pre>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
This class cannot be used to instantiate a working object as it does not refer to a database table which actually exists, so it is what is known as an ‘abstract’ class.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Secondly, I altered each table class to remove the common methods and properties, and included the keyword <code style="font-family: monospace, monospace; font-size: 1em; white-space: pre-wrap; word-wrap: break-word;">extends</code> to force inheritance from the superclass.</div>
<pre style="background-color: white; color: #666666; font-family: monospace, monospace; font-size: 13px; line-height: 22px; white-space: pre-wrap; word-wrap: break-word;">include <span class="string">'default.class.inc'</span>;
class entity1 extends default
{
function entity1 ()
<span class="comment">// constructor</span>
{
<span class="default">$this</span>->tablename = <span class="string">'entity1'</span>;
<span class="default">$this</span>->dbname = <span class="string">'foobar'</span>;
<span class="default">$this</span>->fieldlist = array(<span class="string">'column1'</span>, <span class="string">'column2'</span>, <span class="string">'column3'</span>, <span class="string">'column4'</span>);
<span class="default">$this</span>->primary_key = array(<span class="string">'column1'</span>);
} <span class="comment">// entity1</span>
} <span class="comment">// entity1</span>
</pre>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
When a subclass is instantiated into an object that object will contain all the properties and methods of the superclass as well as those of the subclass. If anything has been defined in both the superclass and the subclass, then the definition from the subclass will be used.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
In my current development environment the superclass contains several thousand lines of code, but there is only one copy of this code which is inherited by several dozen table classes. Inheritance is therefore a powerful mechanism for making one copy of common code accessible to many objects instead of having multiple copies of that common code.</div>
<h3 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 16px; font-weight: 200; line-height: 20px; margin-top: 0px; padding: 0px;">
Polymorphism</h3>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
</div>
<table border="1" cellpadding="3" cellspacing="0" style="background-color: white; border-collapse: collapse; border-spacing: 0px; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px;"><colgroup><col width="100"></col></colgroup><tbody>
<tr><td style="border: none; color: #333333; font-size: 12px; line-height: 18px; padding: 9px 10px; vertical-align: top;">Polymorphism</td><td style="border: none; color: #333333; font-size: 12px; line-height: 18px; padding: 9px 10px; vertical-align: top;">Same interface, different implementation. The ability to substitute one class for another. This means that different classes may contain the same method names, but the result which is returned by each method will be different as the code behind each method (the implementation) is different in each class.</td></tr>
</tbody></table>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Polymorphism can only be employed where the same method names exist in several classes. This means that the same method can be used on different objects, but will yield different results as the implementation of that method is different within each class.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
For example, take a series of classes called ‘Customer’, ‘Product’ and ‘Invoice’. One practice I have seen which makes polymorphism impossible is to incorporate the entity name into the method name, as in:</div>
<ol class="compress" style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 18px 30px; padding: 0px;">
<li>getCustomer(), insertCustomer(), updateCustomer() deleteCustomer()</li>
<li>getProduct(), insertProduct(), updateProduct() deleteProduct()</li>
<li>getInvoice(), insertInvoice(), updateInvoice() deleteInvoice()</li>
</ol>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
The problem with this approach is that the object (the controller in <a href="http://www.tonymarston.net/php-mysql/model-view-controller.html#principles" style="-webkit-transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s; color: #094582; line-height: inherit; text-decoration: none; transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s;">MVC</a>) which communicates with each table object (the model in <a href="http://www.tonymarston.net/php-mysql/model-view-controller.html#principles" style="-webkit-transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s; color: #094582; line-height: inherit; text-decoration: none; transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s;">MVC</a>)needs to know the method name before it can open up that channel of communication. If each model has a unique set of method names then it must have a unique set of controllers to communicate with it.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
My approach is to use a standard set of method names for standard operations, as in:</div>
<ol class="compress" style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; list-style-image: initial; list-style-position: initial; margin: 0px 0px 18px 30px; padding: 0px;">
<li>getData(), insertRecord(), updateRecord() deleteRecord()</li>
</ol>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
This is made easier as these methods are defined in the superclass and made available to each subclass through inheritance.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
The advantage of this is that I can have one standard controller for each standard function, and this controller can work with any table class in the system. This is far better than having a separate set of controllers for each table class.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Here is some example code from one of my controllers:</div>
<pre style="background-color: white; color: #666666; font-family: monospace, monospace; font-size: 13px; line-height: 22px; white-space: pre-wrap; word-wrap: break-word;">....
include <span class="string">"<span class="default">$table</span>.class.inc"</span>;
<span class="default">$object</span> = new <span class="default">$table</span>;
<span class="default">$data</span> = <span class="default">$object</span>->getData(<span class="default">$where</span>);
....</pre>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
The contents of <code style="font-family: monospace, monospace; font-size: 1em; white-space: pre-wrap; word-wrap: break-word;">$table</code> and <code style="font-family: monospace, monospace; font-size: 1em; white-space: pre-wrap; word-wrap: break-word;">$where</code> are made available at runtime.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
The significant point is that the name of the class (database table) is not hard-coded into the controller, it is passed as an argument at runtime. Only the method names are hard-coded, but as these method names exist within every table class by being inherited from the superclass they will always work. So, if the class name is ‘Customer’ the controller will obtain data from the ‘Customer’ table, if it is ‘Product’ it will obtain data from the ‘Product’ table, and so on.</div>
<h2 style="background-color: white; color: #333333; font-family: 'Droid Sans'; font-size: 20px; font-weight: 200; line-height: 22px; margin: 0px 0px 20px; padding: 0px;">
Conclusion</h2>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Many people use different words to describe what OOP is supposed to mean, but the problem with words is that they are slippery. Like Humpty Dumpty proclaimed in Lewis Carroll’s <i style="line-height: inherit;">Through the Looking Glass</i>:</div>
<blockquote style="background-color: white; background-image: url(http://www.developertutorials.com/wp-content/themes/magazon-wp/assets/images/content-quote.png); background-position: 0% 5px; background-repeat: no-repeat no-repeat; border-left-style: none; color: #777777; font-family: 'Droid Sans'; font-size: 13px; font-style: italic; line-height: 20px; margin: 0px 0px 25px 40px; padding: 0px 30px 0px 50px;">
<div style="margin-bottom: 18px;">
When I use a word, it means just what I choose it to mean — neither more nor less.</div>
</blockquote>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
If you take the words used by the originators of OOP and apply different meanings to those words, then others take <i style="line-height: inherit;">your</i> words and apply different meanings to them, then you can end up with something which is nothing like the original, as immortalised in that children’s game called <a href="http://en.wikipedia.org/wiki/Telephone_%28game%29" style="-webkit-transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s; color: #094582; line-height: inherit; text-decoration: none; transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s;" target="_blank">Chinese Whispers</a>.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
There are only three features which really differentiate an Object Oriented language from a non-OO language, and these are Encapsulation, Inheritance and Polymorphism. Everything else is either bullshit or hype. Object Oriented Programming is therefore the use of these features in a programming language. High reusability and low maintainability cannot be guaranteed – that depends entirely on how these features are implemented.</div>
<div style="background-color: white; color: #666666; font-family: 'Droid Sans'; font-size: 13px; line-height: 22px; margin-bottom: 18px;">
Some people accuse me of having a view of OOP which is too simplistic, but instead of saying that my view is "more simple than it need be" surely it can also mean that their view is "more complex than it need be"? As a long-time follower of the <a href="http://en.wikipedia.org/wiki/KISS_principle" style="-webkit-transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s; color: #094582; line-height: inherit; text-decoration: none; transition: background-color 0.2s ease 0s, border 0.2s ease 0s, color 0.2s ease 0s, opacity 0.2s ease-in-out 0s;" target="_blank">KISS principle</a> I know which view I prefer, and I also know which view is easier to teach to others.</div>
</div>
Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-7280696971627524629.post-26606018710626779692013-06-02T23:16:00.004-07:002013-06-02T23:17:28.331-07:00Ajax PHP Database Operation<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="background-color: white; border: 0px; color: #444444; font-weight: 300; line-height: 1.3em; margin: 0px 0px 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">Ajax PHP database operation</span></h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-YKn4biJLDx4/Uaw0nkX10QI/AAAAAAAAAHA/OPDq0xJkDAU/s1600/AjaxDBConnectivity-212x300.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/-YKn4biJLDx4/Uaw0nkX10QI/AAAAAAAAAHA/OPDq0xJkDAU/s1600/AjaxDBConnectivity-212x300.png" /></a></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;"><br />
</span></div>
<div>
<br /></div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">Hi, In this tutorial you’re going to find out ajax <a href="http://voidtricks.com/category/php/" style="-webkit-transition: 0.2s ease; border: 0px; color: #ef3e36; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; transition: 0.2s ease; vertical-align: baseline;">php</a> database operation i.e. how to show list of values from db using ajax via php</span></div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">When a user selects a Name in the dropdown list below, a function called “showDetails()” is executed. The function is triggered by the “onchange” event :</span></div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
</div>
<div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes" data-settings=" minimize scroll-mouseover" id="crayon-51ac31f5ac477" style="background-color: rgb(253, 253, 253) !important; border: 1px solid rgb(153, 153, 153) !important; box-sizing: border-box; clear: both; color: #444444; direction: ltr; float: none; height: auto; line-height: 15px !important; margin: 12px 0px; overflow: hidden !important; padding: 0px; position: relative !important; text-shadow: none !important; vertical-align: baseline; width: 580px;">
<div class="crayon-plain-wrap" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: auto !important; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: baseline;">
<textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-webkit-appearance: none; -webkit-box-shadow: none; -webkit-transition: all 0.2s ease; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-width: 0px; box-shadow: none; color: black; display: block; height: 105px; line-height: 15px !important; margin: 0px; max-width: 100%; opacity: 0; outline: none; overflow: hidden; padding-left: 5px; padding-right: 5px; padding-top: 0px; position: absolute; resize: none; tab-size: 4; transition: all 0.2s ease; white-space: pre; width: 578px; word-wrap: normal; z-index: 0;" wrap="off"></textarea></div>
<div class="crayon-main" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; overflow: hidden; padding: 0px; position: relative; vertical-align: baseline; width: 578px; z-index: 1;">
<table class="crayon-table" style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px !important; border: none !important; font-style: inherit; font-variant: inherit; line-height: inherit; margin-bottom: 0px !important; margin-left: 0px; margin-right: 0px !important; margin-top: 0px !important; padding: 0px !important; text-align: center; vertical-align: baseline; width: auto !important;"><tbody style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
<tr class="crayon-row" style="background-position: 0px 50%; border: none !important; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important;"><td class="crayon-nums " data-settings="show" style="background-color: rgb(223, 239, 255) !important; border: 0px; color: rgb(84, 153, 222) !important; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important;"><div class="crayon-nums-content" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; margin: 0px; padding: 0px; text-align: left; vertical-align: baseline;">
<div class="crayon-num" data-line="crayon-51ac31f5ac477-1" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">1</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac477-2" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">2</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac477-3" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">3</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac477-4" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">4</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac477-5" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">5</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac477-6" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">6</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac477-7" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">7</span></div>
</div>
</td><td class="crayon-code" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important; width: 561px;"><div class="crayon-pre" style="background-image: none !important; border: none !important; font-style: inherit; font-variant: inherit; margin: 0px; overflow: visible; padding: 0px; text-align: left; vertical-align: baseline; white-space: pre;">
<div class="crayon-line" id="crayon-51ac31f5ac477-1" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-r " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><select </span><span class="crayon-e " style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">onChange</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-s " style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"showDetails(this.value)"</span><span class="crayon-r " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac477-2" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-r " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><option </span><span class="crayon-e " style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">value</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-s " style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">""</span><span class="crayon-r " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span><span class="crayon-i " style="border: 0px; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">Select a name</span><span class="crayon-r " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"></option></span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac477-3" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-r " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><option </span><span class="crayon-e " style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">value</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-s " style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"23"</span><span class="crayon-r " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span><span class="crayon-i " style="border: 0px; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">Andrew</span><span class="crayon-r " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"></option></span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac477-4" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-r " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><option </span><span class="crayon-e " style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">value</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-s " style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"24"</span><span class="crayon-r " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span><span class="crayon-i " style="border: 0px; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">Rajesh</span><span class="crayon-r " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"></option></span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac477-5" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-r " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><option </span><span class="crayon-e " style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">value</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-s " style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"25"</span><span class="crayon-r " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span><span class="crayon-i " style="border: 0px; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">Monica</span><span class="crayon-r " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"></option></span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac477-6" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-r " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><span style="font-family: Trebuchet MS, sans-serif;"></select></span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac477-7" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-r " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><div </span><span class="crayon-e " style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">id</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-s " style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"results"</span><span class="crayon-r " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span><span class="crayon-r " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"></div></span></span></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
</div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">In the above code we are passing value of the option to the <a href="http://www.w3schools.com/js/js_functions.asp" style="-webkit-transition: 0.2s ease; border: 0px; color: #ef3e36; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; transition: 0.2s ease; vertical-align: baseline;">function</a> showDetains() onChange</span></div>
<h3 style="background-color: white; border: 0px; color: #444444; font-weight: 300; line-height: 1.3em; margin: 0px 0px 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">Ajax Source</span></h3>
<div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes" data-settings=" minimize scroll-mouseover" id="crayon-51ac31f5ac4c3" style="background-color: rgb(253, 253, 253) !important; border: 1px solid rgb(153, 153, 153) !important; box-sizing: border-box; clear: both; color: #444444; direction: ltr; float: none; height: auto; line-height: 15px !important; margin: 12px 0px; overflow: hidden !important; padding: 0px; position: relative !important; text-shadow: none !important; vertical-align: baseline; width: 580px;">
<div class="crayon-plain-wrap" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: auto !important; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: baseline;">
<textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-webkit-appearance: none; -webkit-box-shadow: none; -webkit-transition: all 0.2s ease; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-width: 0px; box-shadow: none; color: black; display: block; height: 390px; line-height: 15px !important; margin: 0px; max-width: 100%; opacity: 0; outline: none; overflow: hidden; padding-left: 5px; padding-right: 5px; padding-top: 0px; position: absolute; resize: none; tab-size: 4; transition: all 0.2s ease; white-space: pre; width: 578px; word-wrap: normal; z-index: 0;" wrap="off"></textarea></div>
<div class="crayon-main" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; overflow: hidden; padding: 0px; position: relative; vertical-align: baseline; width: 578px; z-index: 1;">
<table class="crayon-table" style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px !important; border: none !important; font-style: inherit; font-variant: inherit; line-height: inherit; margin-bottom: 0px !important; margin-left: 0px; margin-right: 0px !important; margin-top: 0px !important; padding: 0px !important; text-align: center; vertical-align: baseline; width: auto !important;"><tbody style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
<tr class="crayon-row alt" style="background-color: #f2f2f2; border: none !important; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important;"><td class="crayon-nums " data-settings="show" style="background-color: rgb(223, 239, 255) !important; border: 0px; color: rgb(84, 153, 222) !important; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important;"><div class="crayon-nums-content" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; margin: 0px; padding: 0px; text-align: left; vertical-align: baseline;">
<div class="crayon-num" data-line="crayon-51ac31f5ac4c3-1" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">1</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac4c3-2" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">2</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac4c3-3" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">3</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac4c3-4" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">4</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac4c3-5" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">5</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac4c3-6" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">6</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac4c3-7" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">7</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac4c3-8" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">8</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac4c3-9" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">9</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac4c3-10" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">10</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac4c3-11" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">11</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac4c3-12" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">12</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac4c3-13" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">13</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac4c3-14" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">14</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac4c3-15" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">15</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac4c3-16" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">16</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac4c3-17" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">17</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac4c3-18" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">18</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac4c3-19" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">19</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac4c3-20" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">20</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac4c3-21" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">21</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac4c3-22" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">22</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac4c3-23" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">23</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac4c3-24" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">24</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac4c3-25" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">25</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac4c3-26" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">26</span></div>
</div>
</td><td class="crayon-code" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important; width: 554px;"><div class="crayon-pre" style="background-image: none !important; border: none !important; font-style: inherit; font-variant: inherit; margin: 0px; overflow: visible; padding: 0px; text-align: left; vertical-align: baseline; white-space: pre;">
<div class="crayon-line" id="crayon-51ac31f5ac4c3-1" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-t" style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">function</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">showCustomer</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-i" style="border: 0px; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">val</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac4c3-2" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><span style="font-family: Trebuchet MS, sans-serif;">{</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac4c3-3" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-t" style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">var</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-i" style="border: 0px; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">xmlhttp</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac4c3-4" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-st" style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">if</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">val</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">==</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">""</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac4c3-5" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">{</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac4c3-6" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">document</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">getElementById</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"results"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-e " style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">innerHTML</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">""</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac4c3-7" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-st" style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">return</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac4c3-8" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">}</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac4c3-9" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-st" style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">if</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">window</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-i" style="border: 0px; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">XMLHttpRequest</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac4c3-10" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">{</span><span class="crayon-c" style="border: 0px; color: rgb(255, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">// code for IE7+, Firefox, Chrome, Opera, Safari</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac4c3-11" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">xmlhttp</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-r" style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">new</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">XMLHttpRequest</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac4c3-12" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">}</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac4c3-13" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-st" style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><span style="font-family: Trebuchet MS, sans-serif;">else</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac4c3-14" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">{</span><span class="crayon-c" style="border: 0px; color: rgb(255, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">// code for IE6, IE5</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac4c3-15" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">xmlhttp</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-r" style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">new</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">ActiveXObject</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"Microsoft.XMLHTTP"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac4c3-16" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">}</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac4c3-17" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">xmlhttp</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">onreadystatechange</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-t" style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">function</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac4c3-18" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">{</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac4c3-19" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-st" style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">if</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">xmlhttp</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">readyState</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">==</span><span class="crayon-cn" style="border: 0px; color: rgb(206, 0, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">4</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">&&</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">xmlhttp</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">status</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">==</span><span class="crayon-cn" style="border: 0px; color: rgb(206, 0, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">200</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac4c3-20" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">{</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac4c3-21" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">document</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">getElementById</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"results"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">innerHTML</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">xmlhttp</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-i" style="border: 0px; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">responseText</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac4c3-22" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">}</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac4c3-23" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">}</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac4c3-24" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">xmlhttp</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">open</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"GET"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"results.php?id="</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">+</span><span class="crayon-i" style="border: 0px; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">str</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-t" style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">true</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac4c3-25" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">xmlhttp</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">send</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac4c3-26" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><span style="font-family: Trebuchet MS, sans-serif;">}</span></span></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
</div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">Ajax function receives the value and checks whether it is an empty value if it is an empty value it returns blank otherwise it sends the value to results.php with GET method and then it will receive the output given from results.php and shows it in the results div area</span></div>
<h3 style="background-color: white; border: 0px; color: #444444; font-weight: 300; line-height: 1.3em; margin: 0px 0px 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">PHP source</span></h3>
<div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes" data-settings=" minimize scroll-mouseover" id="crayon-51ac31f5ac505" style="background-color: rgb(253, 253, 253) !important; border: 1px solid rgb(153, 153, 153) !important; box-sizing: border-box; clear: both; color: #444444; direction: ltr; float: none; height: auto; line-height: 15px !important; margin: 12px 0px; overflow: hidden !important; padding: 0px; position: relative !important; text-shadow: none !important; vertical-align: baseline; width: 580px;">
<div class="crayon-toolbar" data-settings=" mouseover overlay hide delay" style="background-color: rgb(221, 221, 221) !important; border-bottom-color: rgb(187, 187, 187) !important; border-bottom-style: solid !important; border-bottom-width: 1px !important; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; font-style: inherit; font-variant: inherit; height: 18px !important; line-height: 18px !important; margin: 0px; overflow: hidden; padding: 0px; position: absolute; vertical-align: baseline; width: 578px; z-index: 2;">
<span class="crayon-title" style="border: 0px; color: rgb(51, 51, 51) !important; float: left; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 4px !important; vertical-align: baseline;"><span style="font-family: Trebuchet MS, sans-serif;">Select data from DB</span></span><br />
<div class="crayon-tools" style="background-position: 0px 50%; border: 0px; float: right !important; font-style: inherit; font-variant: inherit; height: 18px !important; line-height: 18px !important; margin: 0px; padding: 0px; position: absolute; right: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-mixed-highlight" style="border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 4px !important; vertical-align: baseline;" title="Contains Mixed Languages"></span></span><br />
<div class="crayon-button crayon-nums-button crayon-pressed" style="background-color: #bcbcbc; background-position: -24px 0px; background-repeat: no-repeat no-repeat; border: 0px; color: white; display: inline; float: left !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: 15px; margin: 0px; padding: 0px; position: relative; vertical-align: baseline; width: 24px;" title="Toggle Line Numbers">
<div class="crayon-button-icon" style="background-image: url(http://voidtricks.com/wp-content/plugins/crayon-syntax-highlighter/css/images/toolbar/buttons.png); background-position: -24px -32px; border: 0px; font-style: inherit; font-variant: inherit; height: 16px !important; left: 0px; line-height: inherit !important; margin: -8px 0px 0px; padding: 0px; position: absolute; top: 50%; vertical-align: baseline; width: 24px;">
</div>
</div>
<div class="crayon-button crayon-plain-button" style="background-position: 0px 50%; background-repeat: no-repeat no-repeat; border: 0px; display: inline; float: left !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: 15px; margin: 0px; padding: 0px; position: relative; vertical-align: baseline; width: 24px;" title="Toggle Plain Code">
<div class="crayon-button-icon" style="background-image: url(http://voidtricks.com/wp-content/plugins/crayon-syntax-highlighter/css/images/toolbar/buttons.png); background-position: 0px -48px; border: 0px; font-style: inherit; font-variant: inherit; height: 16px !important; left: 0px; line-height: inherit !important; margin: -8px 0px 0px; padding: 0px; position: absolute; top: 50%; vertical-align: baseline; width: 24px;">
</div>
</div>
<div class="crayon-button crayon-wrap-button" style="background-position: 0px 50%; background-repeat: no-repeat no-repeat; border: 0px; display: inline; float: left !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: 15px; margin: 0px; padding: 0px; position: relative; vertical-align: baseline; width: 24px;" title="Toggle Line Wrap">
<div class="crayon-button-icon" style="background-image: url(http://voidtricks.com/wp-content/plugins/crayon-syntax-highlighter/css/images/toolbar/buttons.png); background-position: 0px -112px; border: 0px; font-style: inherit; font-variant: inherit; height: 16px !important; left: 0px; line-height: inherit !important; margin: -8px 0px 0px; padding: 0px; position: absolute; top: 50%; vertical-align: baseline; width: 24px;">
</div>
</div>
<div class="crayon-button crayon-expand-button" style="background-position: 0px 50%; background-repeat: no-repeat no-repeat; border: 0px; display: inline; float: left !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: 15px; margin: 0px; padding: 0px; position: relative; vertical-align: baseline; width: 24px;" title="Expand Code">
<div class="crayon-button-icon" style="background-image: url(http://voidtricks.com/wp-content/plugins/crayon-syntax-highlighter/css/images/toolbar/buttons.png); background-position: 0px -96px; border: 0px; font-style: inherit; font-variant: inherit; height: 16px !important; left: 0px; line-height: inherit !important; margin: -8px 0px 0px; padding: 0px; position: absolute; top: 50%; vertical-align: baseline; width: 24px;">
</div>
</div>
<div class="crayon-button crayon-copy-button" style="background-position: 0px 50%; background-repeat: no-repeat no-repeat; border: 0px; display: inline; float: left !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: 15px; margin: 0px; padding: 0px; position: relative; vertical-align: baseline; width: 24px;" title="Expand Code">
<div class="crayon-button-icon" style="background-image: url(http://voidtricks.com/wp-content/plugins/crayon-syntax-highlighter/css/images/toolbar/buttons.png); background-position: 0px -16px; border: 0px; font-style: inherit; font-variant: inherit; height: 16px !important; left: 0px; line-height: inherit !important; margin: -8px 0px 0px; padding: 0px; position: absolute; top: 50%; vertical-align: baseline; width: 24px;">
</div>
</div>
<div class="crayon-button crayon-popup-button" style="background-position: 0px 50%; background-repeat: no-repeat no-repeat; border: 0px; display: inline; float: left !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: 15px; margin: 0px; padding: 0px; position: relative; vertical-align: baseline; width: 24px;" title="Open Code In New Window">
<div class="crayon-button-icon" style="background-image: url(http://voidtricks.com/wp-content/plugins/crayon-syntax-highlighter/css/images/toolbar/buttons.png); background-position: 0px 0px; border: 0px; font-style: inherit; font-variant: inherit; height: 16px !important; left: 0px; line-height: inherit !important; margin: -8px 0px 0px; padding: 0px; position: absolute; top: 50%; vertical-align: baseline; width: 24px;">
</div>
</div>
<span class="crayon-language" style="border: 0px; color: rgb(153, 153, 153) !important; float: left; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 8px 0px 4px !important; vertical-align: baseline;"><span style="font-family: Trebuchet MS, sans-serif;">PHP</span></span></div>
</div>
<div class="crayon-plain-wrap" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: auto !important; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: baseline;">
<textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-webkit-appearance: none; -webkit-box-shadow: none; -webkit-transition: all 0.2s ease; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-width: 0px; box-shadow: none; color: black; display: block; height: 420px; line-height: 15px !important; margin: 0px; max-width: 100%; opacity: 0; outline: none; overflow: hidden; padding-left: 5px; padding-right: 5px; padding-top: 0px; position: absolute; resize: none; tab-size: 4; transition: all 0.2s ease; white-space: pre; width: 578px; word-wrap: normal; z-index: 0;" wrap="off"></textarea></div>
<div class="crayon-main" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; overflow: hidden; padding: 0px; position: relative; vertical-align: baseline; width: 578px; z-index: 1;">
<table class="crayon-table" style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px !important; border: none !important; font-style: inherit; font-variant: inherit; line-height: inherit; margin-bottom: 0px !important; margin-left: 0px; margin-right: 0px !important; margin-top: 0px !important; padding: 0px !important; text-align: center; vertical-align: baseline; width: auto !important;"><tbody style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
<tr class="crayon-row" style="background-position: 0px 50%; border: none !important; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important;"><td class="crayon-nums " data-settings="show" style="background-color: rgb(223, 239, 255) !important; border: 0px; color: rgb(84, 153, 222) !important; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important;"><div class="crayon-nums-content" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; margin: 0px; padding: 0px; text-align: left; vertical-align: baseline;">
<div class="crayon-num" data-line="crayon-51ac31f5ac505-1" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">1</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac505-2" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">2</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac505-3" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">3</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac505-4" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">4</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac505-5" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">5</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac505-6" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">6</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac505-7" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">7</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac505-8" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">8</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac505-9" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">9</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac505-10" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">10</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac505-11" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">11</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac505-12" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">12</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac505-13" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">13</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac505-14" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">14</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac505-15" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">15</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac505-16" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">16</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac505-17" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">17</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac505-18" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">18</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac505-19" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">19</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac505-20" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">20</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac505-21" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">21</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac505-22" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">22</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac505-23" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">23</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac505-24" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">24</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac505-25" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">25</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac505-26" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">26</span></div>
<div class="crayon-num" data-line="crayon-51ac31f5ac505-27" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">27</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac31f5ac505-28" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">28</span></div>
</div>
</td><td class="crayon-code" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important; width: 654px;"><div class="crayon-pre" style="background-image: none !important; border: none !important; font-style: inherit; font-variant: inherit; margin: 0px; overflow: visible; padding: 0px; text-align: left; vertical-align: baseline; white-space: pre;">
<div class="crayon-line" id="crayon-51ac31f5ac505-1" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-ta" style="border: 0px; color: rgb(255, 0, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><span style="font-family: Trebuchet MS, sans-serif;"><?php</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac505-2" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-c" style="border: 0px; color: rgb(255, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><span style="font-family: Trebuchet MS, sans-serif;">// Create connection</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac505-3" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$con</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">mysqli_connect</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"example.com"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"peter"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"abc123"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"my_db"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac505-4" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
</div>
<div class="crayon-line" id="crayon-51ac31f5ac505-5" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-c" style="border: 0px; color: rgb(255, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><span style="font-family: Trebuchet MS, sans-serif;">// Check connection</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac505-6" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-st" style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">if</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">mysqli_connect_errno</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$con</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac505-7" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">{</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac505-8" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-k " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">echo</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"Failed to connect to MySQL: "</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">mysqli_connect_error</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac505-9" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">}</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac505-10" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
</div>
<div class="crayon-line" id="crayon-51ac31f5ac505-11" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-c" style="border: 0px; color: rgb(255, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><span style="font-family: Trebuchet MS, sans-serif;">//save GET value to a php variable</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac505-12" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$userid</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$_GET</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">[</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">'id'</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">]</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac505-13" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
</div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac505-14" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-c" style="border: 0px; color: rgb(255, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><span style="font-family: Trebuchet MS, sans-serif;">//select all fields from the table users</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac505-15" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$query</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"SELECT * FROM users where id = '"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$userid</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"'"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac505-16" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$results</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">mysql_query</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$query</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac505-17" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-ta" style="border: 0px; color: rgb(255, 0, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><span style="font-family: Trebuchet MS, sans-serif;">?></span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac505-18" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
</div>
<div class="crayon-line" id="crayon-51ac31f5ac505-19" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-c" style="border: 0px; color: rgb(255, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><span style="font-family: Trebuchet MS, sans-serif;">//for the titles of the result table</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac505-20" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><</span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">table</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac505-21" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><</span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">tr</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><</span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">td</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">Name</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">/</span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">td</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><</span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">td</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">City</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">/</span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">td</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><</span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">td</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">Mobile</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">/</span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">td</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">/</span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">tr</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac505-22" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-ta" style="border: 0px; color: rgb(255, 0, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><span style="font-family: Trebuchet MS, sans-serif;"><?php</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac505-23" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-st" style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">while</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$row</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">mysql_fetch_array</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$results</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac505-24" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><span style="font-family: Trebuchet MS, sans-serif;">{</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac505-25" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-k " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">echo</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"<tr><td>"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$row</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">[</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">'name'</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">]</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"</td><td>"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$row</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">[</span><span class="crayon-i" style="border: 0px; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">city</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">]</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"</td><td>"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$row</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">[</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">'mobile'</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">]</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"</td></tr>"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac505-26" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><span style="font-family: Trebuchet MS, sans-serif;">}</span></span></div>
<div class="crayon-line" id="crayon-51ac31f5ac505-27" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-ta" style="border: 0px; color: rgb(255, 0, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><span style="font-family: Trebuchet MS, sans-serif;">?></span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac31f5ac505-28" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">/</span><span class="crayon-i" style="border: 0px; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">td</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span></span></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
</div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">results.php gets the value and using mysql query the results have been extracted from the db</span></div>
</div>
<a href="https://plus.google.com/u/0/106212648989926698410?rel=author"><span style="font-family: Trebuchet MS, sans-serif;">-By Parthiv Patel</span></a><br />
<div itemscope="" itemtype="http://schema.org/Person">
<div itemprop="name">
<strong><span style="font-family: Trebuchet MS, sans-serif;">Parthiv Patel</span></strong></div>
<div itemscope="" itemtype="http://schema.org/Organization">
<span itemprop="name" style="font-family: Trebuchet MS, sans-serif;">Bhaishri Info Solution</span></div>
<div itemprop="jobtitle">
<span style="font-family: Trebuchet MS, sans-serif;">Sr. PHP Developer</span></div>
<div itemprop="address" itemscope="" itemtype="http://schema.org/PostalAddress">
<div itemprop="streetAddress">
<span style="font-family: Trebuchet MS, sans-serif;">Limdi Chowk, AT PO. Nar, Di. Anand</span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;"><span itemprop="addressLocality">Nar</span>, <span itemprop="addressRegion">Gujarat</span></span></div>
<div itemprop="postalCode">
<span style="font-family: Trebuchet MS, sans-serif;">388150</span></div>
<div itemprop="addressCountry">
<span style="font-family: Trebuchet MS, sans-serif;">India</span></div>
</div>
<div itemprop="email">
<span style="font-family: Trebuchet MS, sans-serif;">pparthiv2412@gmail.com</span></div>
<div itemprop="telephone">
<span style="font-family: Trebuchet MS, sans-serif;">7383343029</span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;">DOB: 12/24/1986</span></div>
</div>
<br />
<br /></div>
Anonymousnoreply@blogger.com2tag:blogger.com,1999:blog-7280696971627524629.post-5136374808738196212013-06-02T23:10:00.004-07:002013-06-02T23:10:55.942-07:00PHP include from root directory<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="background-color: white; border: 0px; color: #444444; font-family: 'Open Sans', Arial, sans-serif; font-size: 28px; font-weight: 300; line-height: 1.3em; margin: 0px 0px 14px; padding: 0px; vertical-align: baseline;">
PHP include from root directory</h2>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/-g6H1fx5mkkE/Uawy_3eMqoI/AAAAAAAAAGw/4OF9PpCVyw4/s1600/php-include-from-root.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/-g6H1fx5mkkE/Uawy_3eMqoI/AAAAAAAAAGw/4OF9PpCVyw4/s1600/php-include-from-root.png" /></a></div>
<div>
<div style="background-color: white; border: 0px; color: #444444; font-family: 'Open Sans', Arial, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
Some times you would have wondered how to include a file from root directory in page when you are in another directory. we have to give relative path in order to avoid errors if we transfer the page to another root.</div>
<div style="background-color: white; border: 0px; color: #444444; font-family: 'Open Sans', Arial, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
normally we include a file like this</div>
<div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes" data-settings=" minimize scroll-mouseover" id="crayon-51ac3215b533b" style="background-color: rgb(253, 253, 253) !important; border: 1px solid rgb(153, 153, 153) !important; box-sizing: border-box; clear: both; color: #444444; direction: ltr; float: none; font-family: Monaco, MonacoRegular, 'Courier New', monospace; font-size: 12px !important; height: auto; line-height: 15px !important; margin: 12px 0px; overflow: hidden !important; padding: 0px; position: relative !important; text-shadow: none !important; vertical-align: baseline; width: 580px;">
<div class="crayon-plain-wrap" style="background-position: 0px 50%; border: 0px; font-size: inherit; font-style: inherit; font-variant: inherit; height: auto !important; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: baseline;">
<textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-webkit-appearance: none; -webkit-box-shadow: none; -webkit-transition: all 0.2s ease; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-width: 0px; box-shadow: none; color: black; display: block; font-family: Monaco, MonacoRegular, 'Courier New', monospace !important; font-size: 12px !important; height: 15px; line-height: 15px !important; margin: 0px; max-width: 100%; opacity: 0; outline: none; overflow: hidden; padding-left: 5px; padding-right: 5px; padding-top: 0px; position: absolute; resize: none; tab-size: 4; transition: all 0.2s ease; white-space: pre; width: 578px; word-wrap: normal; z-index: 0;" wrap="off"></textarea></div>
<div class="crayon-main" style="background-position: 0px 50%; border: 0px; font-size: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; overflow: hidden; padding: 0px; position: relative; vertical-align: baseline; width: 578px; z-index: 1;">
<table class="crayon-table" style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px !important; border: none !important; font-size: 12px; font-style: inherit; font-variant: inherit; line-height: inherit; margin-bottom: 0px !important; margin-left: 0px; margin-right: 0px !important; margin-top: 0px !important; padding: 0px !important; text-align: center; vertical-align: baseline; width: auto !important;"><tbody style="border: 0px; font-size: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
<tr class="crayon-row" style="background-position: 0px 50%; border: none !important; font-size: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important;"><td class="crayon-nums " data-settings="show" style="background-color: rgb(223, 239, 255) !important; border: 0px; color: rgb(84, 153, 222) !important; font-size: 13px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important;"><div class="crayon-nums-content" style="background-position: 0px 50%; border: 0px; font-size: 12px !important; font-style: inherit; font-variant: inherit; margin: 0px; padding: 0px; text-align: left; vertical-align: baseline;">
<div class="crayon-num" data-line="crayon-51ac3215b533b-1" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
1</div>
</div>
</td><td class="crayon-code" style="background-position: 0px 50%; border: 0px; font-size: 13px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important; width: 561px;"><div class="crayon-pre" style="background-image: none !important; border: none !important; font-size: 12px !important; font-style: inherit; font-variant: inherit; margin: 0px; overflow: visible; padding: 0px; text-align: left; vertical-align: baseline; white-space: pre;">
<div class="crayon-line" id="crayon-51ac3215b533b-1" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">&</span><span class="crayon-i" style="border: 0px; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">lt</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">?</span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">php </span><span class="crayon-k " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">include</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"dbcon.php"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">?</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">&</span><span class="crayon-i" style="border: 0px; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">gt</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: white; border: 0px; color: #444444; font-family: 'Open Sans', Arial, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
</div>
<div style="background-color: white; border: 0px; color: #444444; font-family: 'Open Sans', Arial, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
Because it doesn’t begin with a “/”, it suffers from the same problem our images example suffered from. If that include code moves to a different directory, the reference can be broken. But with PHP, simply using that beginning “/” will not work, which can be mighty confusing.</div>
<div style="background-color: white; border: 0px; color: #444444; font-family: 'Open Sans', Arial, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
The problem is that <a href="https://en.wikipedia.org/wiki/PHP" style="-webkit-transition: 0.2s ease; border: 0px; color: #ef3e36; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; transition: 0.2s ease; vertical-align: baseline;">PHP</a> can see a bit “deeper” into your servers file system than HTML can. For example, the public web directory of voidTricks actually lives at “/var/www/voidTricks/” on my server. So when you do an include with a “/” at the beginning, it looks WAY down deeper than you are intending it to. You actually want it to look in that public web directory. In my case, “voidTricks”.</div>
<div style="background-color: white; border: 0px; color: #444444; font-family: 'Open Sans', Arial, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
but if we want to include a file from root directory we need to automatically find out the root directory path. see the code below</div>
<div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes" data-settings=" minimize scroll-mouseover" id="crayon-51ac3215b5385" style="background-color: rgb(253, 253, 253) !important; border: 1px solid rgb(153, 153, 153) !important; box-sizing: border-box; clear: both; color: #444444; direction: ltr; float: none; font-family: Monaco, MonacoRegular, 'Courier New', monospace; font-size: 12px !important; height: auto; line-height: 15px !important; margin: 12px 0px; overflow: hidden !important; padding: 0px; position: relative !important; text-shadow: none !important; vertical-align: baseline; width: 580px;">
<div class="crayon-plain-wrap" style="background-position: 0px 50%; border: 0px; font-size: inherit; font-style: inherit; font-variant: inherit; height: auto !important; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: baseline;">
<textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-webkit-appearance: none; -webkit-box-shadow: none; -webkit-transition: all 0.2s ease; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-width: 0px; box-shadow: none; color: black; display: block; font-family: Monaco, MonacoRegular, 'Courier New', monospace !important; font-size: 12px !important; height: 75px; line-height: 15px !important; margin: 0px; max-width: 100%; opacity: 0; outline: none; overflow: hidden; padding-left: 5px; padding-right: 5px; padding-top: 0px; position: absolute; resize: none; tab-size: 4; transition: all 0.2s ease; white-space: pre; width: 578px; word-wrap: normal; z-index: 0;" wrap="off"></textarea></div>
<div class="crayon-main" style="background-position: 0px 50%; border: 0px; font-size: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; overflow: hidden; padding: 0px; position: relative; vertical-align: baseline; width: 578px; z-index: 1;">
<table class="crayon-table" style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px !important; border: none !important; font-size: 12px; font-style: inherit; font-variant: inherit; line-height: inherit; margin-bottom: 0px !important; margin-left: 0px; margin-right: 0px !important; margin-top: 0px !important; padding: 0px !important; text-align: center; vertical-align: baseline; width: auto !important;"><tbody style="border: 0px; font-size: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
<tr class="crayon-row alt" style="background-color: #f2f2f2; border: none !important; font-size: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important;"><td class="crayon-nums " data-settings="show" style="background-color: rgb(223, 239, 255) !important; border: 0px; color: rgb(84, 153, 222) !important; font-size: 13px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important;"><div class="crayon-nums-content" style="background-position: 0px 50%; border: 0px; font-size: 12px !important; font-style: inherit; font-variant: inherit; margin: 0px; padding: 0px; text-align: left; vertical-align: baseline;">
<div class="crayon-num" data-line="crayon-51ac3215b5385-1" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
1</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac3215b5385-2" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
2</div>
<div class="crayon-num" data-line="crayon-51ac3215b5385-3" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
3</div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac3215b5385-4" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
4</div>
<div class="crayon-num" data-line="crayon-51ac3215b5385-5" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
5</div>
</div>
</td><td class="crayon-code" style="background-position: 0px 50%; border: 0px; font-size: 13px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important; width: 561px;"><div class="crayon-pre" style="background-image: none !important; border: none !important; font-size: 12px !important; font-style: inherit; font-variant: inherit; margin: 0px; overflow: visible; padding: 0px; text-align: left; vertical-align: baseline; white-space: pre;">
<div class="crayon-line" id="crayon-51ac3215b5385-1" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">&</span><span class="crayon-i" style="border: 0px; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">lt</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">?</span><span class="crayon-i" style="border: 0px; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">php</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac3215b5385-2" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$path</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$_SERVER</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">[</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">'DOCUMENT_ROOT'</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">]</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></div>
<div class="crayon-line" id="crayon-51ac3215b5385-3" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$path</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">.</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"/common/header.php"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac3215b5385-4" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-k " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">include_once</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$path</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></div>
<div class="crayon-line" id="crayon-51ac3215b5385-5" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">?</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">&</span><span class="crayon-i" style="border: 0px; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">gt</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: white; border: 0px; color: #444444; font-family: 'Open Sans', Arial, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
</div>
<div style="background-color: white; border: 0px; color: #444444; font-family: 'Open Sans', Arial, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
That’s it.</div>
<div style="background-color: white; border: 0px; color: #444444; font-family: 'Open Sans', Arial, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
You might be thinking that this is a simple trick. But this is a basic thing that every PHP programmer should know before doing a PHP project.</div>
<div style="background-color: white; border: 0px; color: #444444; font-family: 'Open Sans', Arial, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
share this post if you like it. sharing the knowledge is better than sharing the wealth. Support us by sharing our posts. this will encourage us to post more tricks</div>
<div style="background-color: white; border: 0px; color: #444444; font-family: 'Open Sans', Arial, sans-serif; font-size: 15px; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<br /></div>
</div>
</div>
Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-7280696971627524629.post-82530223844887852582013-06-02T23:06:00.002-07:002013-06-02T23:09:36.280-07:00PHP PDF Generate tutorial<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="background-color: white; border: 0px; color: #444444; font-family: 'Open Sans', Arial, sans-serif; font-size: 28px; font-weight: 300; line-height: 1.3em; margin: 0px 0px 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">PHP PDF Generate tutorial</span></h2>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-U5Tk6owi5E8/Uawy_UvBlZI/AAAAAAAAAGs/MkYvsmD3-Bc/s1600/php-pdf-280x300.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-U5Tk6owi5E8/Uawy_UvBlZI/AAAAAAAAAGs/MkYvsmD3-Bc/s1600/php-pdf-280x300.jpg" /></a></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;"><br /></span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;"><br /></span></div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">Here is the tutorial for php pdf creation.</span></div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">For this you need to download a file called <a href="http://www.fpdf.org/en/download.php" style="-webkit-transition: 0.2s ease; border: 0px; color: #ef3e36; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; transition: 0.2s ease; vertical-align: baseline;">fpdf.php</a></span></div>
<h3 style="background-color: white; border: 0px; color: #444444; font-family: 'Open Sans', Arial, sans-serif; font-size: 24px; font-weight: 300; line-height: 1.3em; margin: 0px 0px 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">Basic Code to generate pdf in php</span></h3>
<div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes" data-settings=" minimize scroll-mouseover" id="crayon-51ac3209e7d02" style="background-color: rgb(253, 253, 253) !important; border: 1px solid rgb(153, 153, 153) !important; box-sizing: border-box; clear: both; color: #444444; direction: ltr; float: none; font-family: Monaco, MonacoRegular, 'Courier New', monospace; font-size: 12px !important; height: auto; line-height: 15px !important; margin: 12px 0px; overflow: hidden !important; padding: 0px; position: relative !important; text-shadow: none !important; vertical-align: baseline; width: 580px;">
<div class="crayon-plain-wrap" style="background-position: 0px 50%; border: 0px; font-size: inherit; font-style: inherit; font-variant: inherit; height: auto !important; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-webkit-appearance: none; -webkit-box-shadow: none; -webkit-transition: all 0.2s ease; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-width: 0px; box-shadow: none; color: black; display: block; font-family: Monaco, MonacoRegular, 'Courier New', monospace !important; font-size: 12px !important; height: 165px; line-height: 15px !important; margin: 0px; max-width: 100%; opacity: 0; outline: none; overflow: hidden; padding-left: 5px; padding-right: 5px; padding-top: 0px; position: absolute; resize: none; tab-size: 4; transition: all 0.2s ease; white-space: pre; width: 578px; word-wrap: normal; z-index: 0;" wrap="off"></textarea></span></div>
<div class="crayon-main" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; overflow: hidden; padding: 0px; position: relative; vertical-align: baseline; width: 578px; z-index: 1;">
<table class="crayon-table" style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px !important; border: none !important; font-size: 12px; font-style: inherit; font-variant: inherit; line-height: inherit; margin-bottom: 0px !important; margin-left: 0px; margin-right: 0px !important; margin-top: 0px !important; padding: 0px !important; text-align: center; vertical-align: baseline; width: auto !important;"><tbody style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
<tr class="crayon-row" style="background-position: 0px 50%; border: none !important; font-size: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important;"><td class="crayon-nums " data-settings="show" style="background-color: rgb(223, 239, 255) !important; border: 0px; color: rgb(84, 153, 222) !important; font-size: 13px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important;"><div class="crayon-nums-content" style="background-position: 0px 50%; border: 0px; font-size: 12px !important; font-style: inherit; font-variant: inherit; margin: 0px; padding: 0px; text-align: left; vertical-align: baseline;">
<div class="crayon-num" data-line="crayon-51ac3209e7d02-1" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">1</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac3209e7d02-2" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">2</span></div>
<div class="crayon-num" data-line="crayon-51ac3209e7d02-3" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">3</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac3209e7d02-4" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">4</span></div>
<div class="crayon-num" data-line="crayon-51ac3209e7d02-5" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">5</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac3209e7d02-6" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">6</span></div>
<div class="crayon-num" data-line="crayon-51ac3209e7d02-7" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">7</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac3209e7d02-8" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">8</span></div>
<div class="crayon-num" data-line="crayon-51ac3209e7d02-9" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">9</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac3209e7d02-10" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">10</span></div>
<div class="crayon-num" data-line="crayon-51ac3209e7d02-11" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">11</span></div>
</div>
</td><td class="crayon-code" style="background-position: 0px 50%; border: 0px; font-size: 13px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important; width: 554px;"><div class="crayon-pre" style="background-image: none !important; border: none !important; font-size: 12px !important; font-style: inherit; font-variant: inherit; margin: 0px; overflow: visible; padding: 0px; text-align: left; vertical-align: baseline; white-space: pre;">
<div class="crayon-line" id="crayon-51ac3209e7d02-1" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">require</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"fpdf.php"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac3209e7d02-2" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
</div>
<div class="crayon-line" id="crayon-51ac3209e7d02-3" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">pdf</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-r" style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">new</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">FPDF</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac3209e7d02-4" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
</div>
<div class="crayon-line" id="crayon-51ac3209e7d02-5" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$</span><span class="crayon-i" style="border: 0px; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">pdf</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">-></span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">AddPage</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac3209e7d02-6" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
</div>
<div class="crayon-line" id="crayon-51ac3209e7d02-7" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$</span><span class="crayon-i" style="border: 0px; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">pdf</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">-></span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">SetFont</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">'Arial'</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">'B'</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-cn" style="border: 0px; color: rgb(206, 0, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">16</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac3209e7d02-8" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
</div>
<div class="crayon-line" id="crayon-51ac3209e7d02-9" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$</span><span class="crayon-i" style="border: 0px; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">pdf</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">-></span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">Cell</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-cn" style="border: 0px; color: rgb(206, 0, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">0</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-cn" style="border: 0px; color: rgb(206, 0, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">10</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">'PHP - The Good Parts!'</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac3209e7d02-10" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
</div>
<div class="crayon-line" id="crayon-51ac3209e7d02-11" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$</span><span class="crayon-i" style="border: 0px; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">pdf</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">-></span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">Output</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
</div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">Take a look at the code, First you need to include the fpdf.php file using <a href="http://php.net/manual/en/function.require.php" style="-webkit-transition: 0.2s ease; border: 0px; color: #ef3e36; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; transition: 0.2s ease; vertical-align: baseline;">require()</a>function.</span></div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">after requiring the library file, we instantiate an object of the FPDF class and call it $pdf.</span></div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">Then we add a page with the AddPage method, set our output font, define the cell (location) for our string of output, and then—using the Output method—display the PDF in the browser.</span></div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">Output for the above code will be</span></div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<a href="http://voidtricks.com/wp-content/uploads/2013/05/php-pdf.png" style="-webkit-transition: 0.2s ease; border: 0px; color: #ef3e36; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; transition: 0.2s ease; vertical-align: baseline;"><span style="font-family: Trebuchet MS, sans-serif;"><img alt="php pdf" class="alignnone size-medium wp-image-476" height="106" src="http://voidtricks.com/wp-content/uploads/2013/05/php-pdf-300x106.png" style="-webkit-transition: opacity 0.2s ease; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; height: auto; line-height: inherit; margin: 0px; max-width: 100%; padding: 0px; transition: opacity 0.2s ease; vertical-align: baseline;" width="300" /></span></a></div>
<h3 style="background-color: white; border: 0px; color: #444444; font-family: 'Open Sans', Arial, sans-serif; font-size: 24px; font-weight: 300; line-height: 1.3em; margin: 0px 0px 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">PHP PDF generate using cell</span></h3>
<div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes" data-settings=" minimize scroll-mouseover" id="crayon-51ac3209e7d44" style="background-color: rgb(253, 253, 253) !important; border: 1px solid rgb(153, 153, 153) !important; box-sizing: border-box; clear: both; color: #444444; direction: ltr; float: none; font-family: Monaco, MonacoRegular, 'Courier New', monospace; font-size: 12px !important; height: auto; line-height: 15px !important; margin: 12px 0px; overflow: hidden !important; padding: 0px; position: relative !important; text-shadow: none !important; vertical-align: baseline; width: 580px;">
<div class="crayon-plain-wrap" style="background-position: 0px 50%; border: 0px; font-size: inherit; font-style: inherit; font-variant: inherit; height: auto !important; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-webkit-appearance: none; -webkit-box-shadow: none; -webkit-transition: all 0.2s ease; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-width: 0px; box-shadow: none; color: black; display: block; font-family: Monaco, MonacoRegular, 'Courier New', monospace !important; font-size: 12px !important; height: 240px; line-height: 15px !important; margin: 0px; max-width: 100%; opacity: 0; outline: none; overflow: hidden; padding-left: 5px; padding-right: 5px; padding-top: 0px; position: absolute; resize: none; tab-size: 4; transition: all 0.2s ease; white-space: pre; width: 578px; word-wrap: normal; z-index: 0;" wrap="off"></textarea></span></div>
<div class="crayon-main" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; overflow: hidden; padding: 0px; position: relative; vertical-align: baseline; width: 578px; z-index: 1;">
<table class="crayon-table" style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px !important; border: none !important; font-size: 12px; font-style: inherit; font-variant: inherit; line-height: inherit; margin-bottom: 0px !important; margin-left: 0px; margin-right: 0px !important; margin-top: 0px !important; padding: 0px !important; text-align: center; vertical-align: baseline; width: auto !important;"><tbody style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
<tr class="crayon-row alt" style="background-color: #f2f2f2; border: none !important; font-size: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important;"><td class="crayon-nums " data-settings="show" style="background-color: rgb(223, 239, 255) !important; border: 0px; color: rgb(84, 153, 222) !important; font-size: 13px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important;"><div class="crayon-nums-content" style="background-position: 0px 50%; border: 0px; font-size: 12px !important; font-style: inherit; font-variant: inherit; margin: 0px; padding: 0px; text-align: left; vertical-align: baseline;">
<div class="crayon-num" data-line="crayon-51ac3209e7d44-1" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">1</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac3209e7d44-2" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">2</span></div>
<div class="crayon-num" data-line="crayon-51ac3209e7d44-3" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">3</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac3209e7d44-4" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">4</span></div>
<div class="crayon-num" data-line="crayon-51ac3209e7d44-5" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">5</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac3209e7d44-6" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">6</span></div>
<div class="crayon-num" data-line="crayon-51ac3209e7d44-7" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">7</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac3209e7d44-8" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">8</span></div>
<div class="crayon-num" data-line="crayon-51ac3209e7d44-9" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">9</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac3209e7d44-10" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">10</span></div>
<div class="crayon-num" data-line="crayon-51ac3209e7d44-11" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">11</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac3209e7d44-12" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">12</span></div>
<div class="crayon-num" data-line="crayon-51ac3209e7d44-13" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">13</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac3209e7d44-14" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">14</span></div>
<div class="crayon-num" data-line="crayon-51ac3209e7d44-15" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">15</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac3209e7d44-16" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">16</span></div>
</div>
</td><td class="crayon-code" style="background-position: 0px 50%; border: 0px; font-size: 13px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important; width: 554px;"><div class="crayon-pre" style="background-image: none !important; border: none !important; font-size: 12px !important; font-style: inherit; font-variant: inherit; margin: 0px; overflow: visible; padding: 0px; text-align: left; vertical-align: baseline; white-space: pre;">
<div class="crayon-line" id="crayon-51ac3209e7d44-1" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">require</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"fpdf.php"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac3209e7d44-2" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
</div>
<div class="crayon-line" id="crayon-51ac3209e7d44-3" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
</div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac3209e7d44-4" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">pdf</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-r" style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">new</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">FPDF</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line" id="crayon-51ac3209e7d44-5" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
</div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac3209e7d44-6" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$</span><span class="crayon-i" style="border: 0px; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">pdf</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">-></span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">AddPage</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line" id="crayon-51ac3209e7d44-7" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
</div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac3209e7d44-8" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$</span><span class="crayon-i" style="border: 0px; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">pdf</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">-></span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">SetFont</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">'Arial'</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">'B'</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-cn" style="border: 0px; color: rgb(206, 0, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">16</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line" id="crayon-51ac3209e7d44-9" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
</div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac3209e7d44-10" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$</span><span class="crayon-i" style="border: 0px; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">pdf</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">-></span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">Cell</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-cn" style="border: 0px; color: rgb(206, 0, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">10</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-cn" style="border: 0px; color: rgb(206, 0, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">10</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">'PHP - The Good Parts!'</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-cn" style="border: 0px; color: rgb(206, 0, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">0</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-cn" style="border: 0px; color: rgb(206, 0, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">0</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">'L'</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line" id="crayon-51ac3209e7d44-11" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
</div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac3209e7d44-12" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$</span><span class="crayon-i" style="border: 0px; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">pdf</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">-></span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">SetX</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-cn" style="border: 0px; color: rgb(206, 0, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">90</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line" id="crayon-51ac3209e7d44-13" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
</div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac3209e7d44-14" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$</span><span class="crayon-i" style="border: 0px; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">pdf</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">-></span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">Cell</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-cn" style="border: 0px; color: rgb(206, 0, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">90</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-cn" style="border: 0px; color: rgb(206, 0, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">10</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">'Beware the Ides of March!'</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-cn" style="border: 0px; color: rgb(206, 0, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">1</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-cn" style="border: 0px; color: rgb(206, 0, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">0</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">'C'</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line" id="crayon-51ac3209e7d44-15" style="background-position: 0px 50%; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
</div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac3209e7d44-16" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$</span><span class="crayon-i" style="border: 0px; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">pdf</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">-></span><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">Output</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-family: inherit; font-size: inherit !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
</div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">In the above code we’ve used cell method.</span></div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">For the first text “PHP – The Good Parts!” we’ve given x=10 and y=10 and 0,0,’L’ denotes column, row and text alignment respectively.</span></div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">So the output will be</span></div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<a href="http://voidtricks.com/wp-content/uploads/2013/05/php-pdf-cell.png" style="-webkit-transition: 0.2s ease; border: 0px; color: #ef3e36; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; transition: 0.2s ease; vertical-align: baseline;"><span style="font-family: Trebuchet MS, sans-serif;"><img alt="php pdf" class="alignnone size-medium wp-image-475" height="56" src="http://voidtricks.com/wp-content/uploads/2013/05/php-pdf-cell-300x56.png" style="-webkit-transition: opacity 0.2s ease; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; height: auto; line-height: inherit; margin: 0px; max-width: 100%; padding: 0px; transition: opacity 0.2s ease; vertical-align: baseline;" width="300" /></span></a></div>
<h4 style="background-color: white; border: 0px; color: #444444; line-height: inherit; margin: 0px 0px 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">NOTE:</span></h4>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">You may want to disable your browser’s caching capabilities while you are developing and testing the layout of your FPDF PDFs because some browsers will not reload the page with changes if the changes are so small that they don’t register as such with the cache control.</span></div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span></div>
</div>
<a href="https://plus.google.com/u/0/106212648989926698410?rel=author"><span style="font-family: Trebuchet MS, sans-serif;">-By Parthiv Patel</span></a><br />
<div itemscope="" itemtype="http://schema.org/Person">
<div itemprop="name">
<strong><span style="font-family: Trebuchet MS, sans-serif;">Parthiv Patel</span></strong></div>
<div itemscope="" itemtype="http://schema.org/Organization">
<span itemprop="name" style="font-family: Trebuchet MS, sans-serif;">Bhaishri Info Solution</span></div>
<div itemprop="jobtitle">
<span style="font-family: Trebuchet MS, sans-serif;">Sr. PHP Developer</span></div>
<div itemprop="address" itemscope="" itemtype="http://schema.org/PostalAddress">
<div itemprop="streetAddress">
<span style="font-family: Trebuchet MS, sans-serif;">Limdi Chowk, AT PO. Nar, Di. Anand</span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;"><span itemprop="addressLocality">Nar</span>, <span itemprop="addressRegion">Gujarat</span></span></div>
<div itemprop="postalCode">
<span style="font-family: Trebuchet MS, sans-serif;">388150</span></div>
<div itemprop="addressCountry">
<span style="font-family: Trebuchet MS, sans-serif;">India</span></div>
</div>
<div itemprop="email">
<span style="font-family: Trebuchet MS, sans-serif;">pparthiv2412@gmail.com</span></div>
<div itemprop="telephone">
<span style="font-family: Trebuchet MS, sans-serif;">7383343029</span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;">DOB: 12/24/1986</span></div>
</div>
<br /></div>
Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-7280696971627524629.post-43396438295852388522013-06-02T22:58:00.001-07:002013-06-02T22:58:17.253-07:00Extract function in PHP<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="background-color: white; border: 0px; color: #444444; font-weight: 300; line-height: 1.3em; margin: 0px 0px 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">Extract function tutorial in php</span></h2>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">The extract () function imports variables into the local symbol table from an <a href="http://en.wikipedia.org/wiki/Array" style="-webkit-transition: 0.2s ease; border: 0px; color: #ef3e36; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; outline: 0px; padding: 0px; text-decoration: none; transition: 0.2s ease; vertical-align: baseline;">array</a>.</span></div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">This function uses array keys as variable names and values as variable values. For each element it will create a variable in the current symbol table.</span></div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">This function returns the number of variables extracted on success.</span></div>
<h3 style="background-color: white; border: 0px; color: #444444; font-weight: 300; line-height: 1.3em; margin: 0px 0px 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">Extract function syntax</span></h3>
<div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes" data-settings=" minimize scroll-mouseover" id="crayon-51ac301648002" style="background-color: rgb(253, 253, 253) !important; border: 1px solid rgb(153, 153, 153) !important; box-sizing: border-box; clear: both; color: #444444; direction: ltr; float: none; height: auto; line-height: 15px !important; margin: 12px 0px; overflow: hidden !important; padding: 0px; position: relative !important; text-shadow: none !important; vertical-align: baseline; width: 580px;">
<div class="crayon-plain-wrap" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: auto !important; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: baseline;">
<textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-webkit-appearance: none; -webkit-box-shadow: none; -webkit-transition: all 0.2s ease; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-width: 0px; box-shadow: none; color: black; display: block; height: 15px; line-height: 15px !important; margin: 0px; max-width: 100%; opacity: 0; outline: none; overflow: hidden; padding-left: 5px; padding-right: 5px; padding-top: 0px; position: absolute; resize: none; tab-size: 4; transition: all 0.2s ease; white-space: pre; width: 578px; word-wrap: normal; z-index: 0;" wrap="off"></textarea></div>
<div class="crayon-main" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; overflow: hidden; padding: 0px; position: relative; vertical-align: baseline; width: 578px; z-index: 1;">
<table class="crayon-table" style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px !important; border: none !important; font-style: inherit; font-variant: inherit; line-height: inherit; margin-bottom: 0px !important; margin-left: 0px; margin-right: 0px !important; margin-top: 0px !important; padding: 0px !important; text-align: center; vertical-align: baseline; width: auto !important;"><tbody style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
<tr class="crayon-row" style="background-position: 0px 50%; border: none !important; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important;"><td class="crayon-nums " data-settings="show" style="background-color: rgb(223, 239, 255) !important; border: 0px; color: rgb(84, 153, 222) !important; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important;"><div class="crayon-nums-content" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; margin: 0px; padding: 0px; text-align: left; vertical-align: baseline;">
<div class="crayon-num" data-line="crayon-51ac301648002-1" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">1</span></div>
</div>
</td><td class="crayon-code" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important; width: 561px;"><div class="crayon-pre" style="background-image: none !important; border: none !important; font-style: inherit; font-variant: inherit; margin: 0px; overflow: visible; padding: 0px; text-align: left; vertical-align: baseline; white-space: pre;">
<div class="crayon-line" id="crayon-51ac301648002-1" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">extract</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-t" style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">array</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-i" style="border: 0px; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">extract_rules</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-i" style="border: 0px; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">prefix</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span></span></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<table style="background-color: white; border-collapse: collapse; border-spacing: 0px; border: 0px; color: #444444; line-height: 24px; margin: 0px 0px 1.5em; padding: 0px; text-align: center; vertical-align: baseline; width: 580px;"><tbody style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
<tr class="alt" style="background-color: #f2f2f2; border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"><th align="left" style="border-bottom-color: rgb(242, 242, 242); border-bottom-style: solid; border-top-color: rgb(242, 242, 242); border-top-style: solid; border-width: 1px 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 10px 5px; vertical-align: baseline;" valign="top" width="20%"><span style="font-family: Trebuchet MS, sans-serif;">Parameter</span></th><th align="left" style="border-bottom-color: rgb(242, 242, 242); border-bottom-style: solid; border-top-color: rgb(242, 242, 242); border-top-style: solid; border-width: 1px 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 10px 5px; vertical-align: baseline;" valign="top" width="80%"><span style="font-family: Trebuchet MS, sans-serif;">Description</span></th></tr>
<tr style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"><td style="border-bottom-color: rgb(229, 229, 229); border-bottom-style: solid; border-width: 0px 0px 1px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 5px; vertical-align: middle;" valign="top"><span style="font-family: Trebuchet MS, sans-serif;">array</span></td><td style="border-bottom-color: rgb(229, 229, 229); border-bottom-style: solid; border-width: 0px 0px 1px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 5px; vertical-align: middle;" valign="top"><span style="font-family: Trebuchet MS, sans-serif;">Required. Specifies the array to use</span></td></tr>
<tr class="alt" style="background-color: #f2f2f2; border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"><td style="border-bottom-color: rgb(229, 229, 229); border-bottom-style: solid; border-width: 0px 0px 1px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 5px; vertical-align: middle;" valign="top"><span style="font-family: Trebuchet MS, sans-serif;">extract_rules</span></td><td style="border-bottom-color: rgb(229, 229, 229); border-bottom-style: solid; border-width: 0px 0px 1px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 5px; vertical-align: middle;" valign="top"><span style="font-family: Trebuchet MS, sans-serif;">Optional. The extract() function checks for invalid variable names and collisions with existing variable names. This parameter specifies how invalid and colliding names are treated.Possible values:</span><br />
<div style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
</div>
<ul style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; list-style: none; margin: 14px 0px 14px 30px; padding: 0px; vertical-align: baseline;">
<li style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; list-style: square; margin: 0px; padding: 0px; vertical-align: baseline;"><span style="font-family: Trebuchet MS, sans-serif;">EXTR_OVERWRITE – Default. On collision, the existing variable is overwritten</span></li>
<li style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; list-style: square; margin: 0px; padding: 0px; vertical-align: baseline;"><span style="font-family: Trebuchet MS, sans-serif;">EXTR_SKIP – On collision, the existing variable is not overwritten</span></li>
<li style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; list-style: square; margin: 0px; padding: 0px; vertical-align: baseline;"><span style="font-family: Trebuchet MS, sans-serif;">EXTR_PREFIX_SAME – On collision, the variable name will be given a prefix</span></li>
<li style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; list-style: square; margin: 0px; padding: 0px; vertical-align: baseline;"><span style="font-family: Trebuchet MS, sans-serif;">EXTR_PREFIX_ALL – All variable names will be given a prefix</span></li>
<li style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; list-style: square; margin: 0px; padding: 0px; vertical-align: baseline;"><span style="font-family: Trebuchet MS, sans-serif;">EXTR_PREFIX_INVALID – Only invalid or numeric variable names will be given a prefix</span></li>
<li style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; list-style: square; margin: 0px; padding: 0px; vertical-align: baseline;"><span style="font-family: Trebuchet MS, sans-serif;">EXTR_IF_EXISTS – Only overwrite existing variables in the current symbol table, otherwise do nothing</span></li>
<li style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; list-style: square; margin: 0px; padding: 0px; vertical-align: baseline;"><span style="font-family: Trebuchet MS, sans-serif;">EXTR_PREFIX_IF_EXISTS – Only add prefix to variables if the same variable exists in the current symbol table</span></li>
<li style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; list-style: square; margin: 0px; padding: 0px; vertical-align: baseline;"><span style="font-family: Trebuchet MS, sans-serif;">EXTR_REFS – Extracts variables as references. The imported variables are still referencing the values of the array parameter</span></li>
</ul>
</td></tr>
<tr style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"><td style="border-bottom-color: rgb(229, 229, 229); border-bottom-style: solid; border-width: 0px 0px 1px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 5px; vertical-align: middle;" valign="top"><span style="font-family: Trebuchet MS, sans-serif;">prefix</span></td><td style="border-bottom-color: rgb(229, 229, 229); border-bottom-style: solid; border-width: 0px 0px 1px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 5px; vertical-align: middle;" valign="top"><span style="font-family: Trebuchet MS, sans-serif;">Optional. If EXTR_PREFIX_SAME, EXTR_PREFIX_ALL, EXTR_PREFIX_INVALID or EXTR_PREFIX_IF_EXISTS are used in the extract_rules parameter, a specified prefix is required.This parameter specifies the prefix. The prefix is automatically separated from the array key by an underscore character.</span><br />
<div style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
</div>
<div style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<br /></div>
</td></tr>
</tbody></table>
<h3 style="background-color: white; border: 0px; color: #444444; font-weight: 300; line-height: 1.3em; margin: 0px 0px 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">Example 1</span></h3>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
</div>
<div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes" data-settings=" minimize scroll-mouseover" id="crayon-51ac301648055" style="background-color: rgb(253, 253, 253) !important; border: 1px solid rgb(153, 153, 153) !important; box-sizing: border-box; clear: both; color: #444444; direction: ltr; float: none; height: auto; line-height: 15px !important; margin: 12px 0px; overflow: hidden !important; padding: 0px; position: relative !important; text-shadow: none !important; vertical-align: baseline; width: 580px;">
<div class="crayon-plain-wrap" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: auto !important; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: baseline;">
<textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-webkit-appearance: none; -webkit-box-shadow: none; -webkit-transition: all 0.2s ease; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-width: 0px; box-shadow: none; color: black; display: block; height: 90px; line-height: 15px !important; margin: 0px; max-width: 100%; opacity: 0; outline: none; overflow: hidden; padding-left: 5px; padding-right: 5px; padding-top: 0px; position: absolute; resize: none; tab-size: 4; transition: all 0.2s ease; white-space: pre; width: 578px; word-wrap: normal; z-index: 0;" wrap="off"></textarea></div>
<div class="crayon-main" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; overflow: hidden; padding: 0px; position: relative; vertical-align: baseline; width: 578px; z-index: 1;">
<table class="crayon-table" style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px !important; border: none !important; font-style: inherit; font-variant: inherit; line-height: inherit; margin-bottom: 0px !important; margin-left: 0px; margin-right: 0px !important; margin-top: 0px !important; padding: 0px !important; text-align: center; vertical-align: baseline; width: auto !important;"><tbody style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
<tr class="crayon-row alt" style="background-color: #f2f2f2; border: none !important; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important;"><td class="crayon-nums " data-settings="show" style="background-color: rgb(223, 239, 255) !important; border: 0px; color: rgb(84, 153, 222) !important; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important;"><div class="crayon-nums-content" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; margin: 0px; padding: 0px; text-align: left; vertical-align: baseline;">
<div class="crayon-num" data-line="crayon-51ac301648055-1" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">1</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac301648055-2" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">2</span></div>
<div class="crayon-num" data-line="crayon-51ac301648055-3" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">3</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac301648055-4" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">4</span></div>
<div class="crayon-num" data-line="crayon-51ac301648055-5" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">5</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac301648055-6" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">6</span></div>
</div>
</td><td class="crayon-code" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important; width: 561px;"><div class="crayon-pre" style="background-image: none !important; border: none !important; font-style: inherit; font-variant: inherit; margin: 0px; overflow: visible; padding: 0px; text-align: left; vertical-align: baseline; white-space: pre;">
<div class="crayon-line" id="crayon-51ac301648055-1" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-ta" style="border: 0px; color: rgb(255, 0, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><span style="font-family: Trebuchet MS, sans-serif;"><?php</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac301648055-2" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$a</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">'Original'</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line" id="crayon-51ac301648055-3" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$my_array</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-t" style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">array</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"a"</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"Cat"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"b"</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"Dog"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"c"</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"Horse"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac301648055-4" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">extract</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$my_array</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line" id="crayon-51ac301648055-5" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-k " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">echo</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"\$a = $a; \$b = $b; \$c = $c"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac301648055-6" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-ta" style="border: 0px; color: rgb(255, 0, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><span style="font-family: Trebuchet MS, sans-serif;">?></span></span></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
</div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">The output of the code above will be:</span></div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<code style="background-color: #eeeeee; border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px 3px; vertical-align: baseline;"><span style="font-family: Trebuchet MS, sans-serif;">$a = Cat; $b = Dog; $c = Horse</span></code></div>
<h3 style="background-color: white; border: 0px; color: #444444; font-weight: 300; line-height: 1.3em; margin: 0px 0px 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">Example 2</span></h3>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">With all parameters in use:</span></div>
<div class="crayon-syntax crayon-theme-classic crayon-font-monaco crayon-os-pc print-yes" data-settings=" minimize scroll-mouseover" id="crayon-51ac30164809f" style="background-color: rgb(253, 253, 253) !important; border: 1px solid rgb(153, 153, 153) !important; box-sizing: border-box; clear: both; color: #444444; direction: ltr; float: none; height: auto; line-height: 15px !important; margin: 12px 0px; overflow: hidden !important; padding: 0px; position: relative !important; text-shadow: none !important; vertical-align: baseline; width: 580px;">
<div class="crayon-plain-wrap" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: auto !important; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: baseline;">
<textarea class="crayon-plain print-no" data-settings="dblclick" readonly="" style="-webkit-appearance: none; -webkit-box-shadow: none; -webkit-transition: all 0.2s ease; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; border-width: 0px; box-shadow: none; color: black; display: block; height: 120px; line-height: 15px !important; margin: 0px; max-width: 100%; opacity: 0; outline: none; overflow: hidden; padding-left: 5px; padding-right: 5px; padding-top: 0px; position: absolute; resize: none; tab-size: 4; transition: all 0.2s ease; white-space: pre; width: 578px; word-wrap: normal; z-index: 0;" wrap="off"></textarea></div>
<div class="crayon-main" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; overflow: hidden; padding: 0px; position: relative; vertical-align: baseline; width: 578px; z-index: 1;">
<table class="crayon-table" style="background-image: none !important; border-collapse: collapse !important; border-spacing: 0px !important; border: none !important; font-style: inherit; font-variant: inherit; line-height: inherit; margin-bottom: 0px !important; margin-left: 0px; margin-right: 0px !important; margin-top: 0px !important; padding: 0px !important; text-align: center; vertical-align: baseline; width: auto !important;"><tbody style="border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
<tr class="crayon-row" style="background-position: 0px 50%; border: none !important; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important;"><td class="crayon-nums " data-settings="show" style="background-color: rgb(223, 239, 255) !important; border: 0px; color: rgb(84, 153, 222) !important; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important;"><div class="crayon-nums-content" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; margin: 0px; padding: 0px; text-align: left; vertical-align: baseline;">
<div class="crayon-num" data-line="crayon-51ac30164809f-1" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">1</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac30164809f-2" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">2</span></div>
<div class="crayon-num" data-line="crayon-51ac30164809f-3" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">3</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac30164809f-4" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">4</span></div>
<div class="crayon-num" data-line="crayon-51ac30164809f-5" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">5</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac30164809f-6" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">6</span></div>
<div class="crayon-num" data-line="crayon-51ac30164809f-7" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">7</span></div>
<div class="crayon-num crayon-striped-num" data-line="crayon-51ac30164809f-8" style="background-color: rgb(200, 225, 250) !important; border: 0px; color: rgb(49, 124, 197) !important; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; text-align: center; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">8</span></div>
</div>
</td><td class="crayon-code" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px !important; padding: 0px !important; vertical-align: top !important; width: 561px;"><div class="crayon-pre" style="background-image: none !important; border: none !important; font-style: inherit; font-variant: inherit; margin: 0px; overflow: visible; padding: 0px; text-align: left; vertical-align: baseline; white-space: pre;">
<div class="crayon-line" id="crayon-51ac30164809f-1" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-ta" style="border: 0px; color: rgb(255, 0, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><span style="font-family: Trebuchet MS, sans-serif;"><?php</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac30164809f-2" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$a</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">'Original'</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line" id="crayon-51ac30164809f-3" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$my_array</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-t" style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">array</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"a"</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"Cat"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"b"</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"Dog"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"c"</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">=</span><span class="crayon-o" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">></span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"Horse"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac30164809f-4" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
</div>
<div class="crayon-line" id="crayon-51ac30164809f-5" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-e" style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">extract</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">(</span><span class="crayon-v" style="border: 0px; color: rgb(0, 45, 122) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">$my_array</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-e " style="border: 0px; color: rgb(0, 78, 208) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">EXTR_PREFIX_SAME</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">,</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">'dup'</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">)</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac30164809f-6" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
</div>
<div class="crayon-line" id="crayon-51ac30164809f-7" style="background-position: 0px 50%; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;"><span class="crayon-k " style="border: 0px; color: rgb(128, 0, 128) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">echo</span><span class="crayon-h" style="border: 0px; color: rgb(0, 111, 224) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"> </span><span class="crayon-s" style="border: 0px; color: rgb(0, 128, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">"\$a = $a; \$b = $b; \$c = $c; \$dup_a = $dup_a;"</span><span class="crayon-sy" style="border: 0px; color: rgb(51, 51, 51) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;">;</span></span></div>
<div class="crayon-line crayon-striped-line" id="crayon-51ac30164809f-8" style="background-color: rgb(247, 247, 247) !important; border: 0px; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px 5px; vertical-align: baseline;">
<span class="crayon-ta" style="border: 0px; color: rgb(255, 0, 0) !important; display: inline-block; font-style: inherit; font-variant: inherit; height: inherit !important; line-height: inherit !important; margin: 0px; padding: 0px; vertical-align: baseline; zoom: 1;"><span style="font-family: Trebuchet MS, sans-serif;">?></span></span></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
</div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<span style="font-family: Trebuchet MS, sans-serif;">The output of the code above will be:</span></div>
<div style="background-color: white; border: 0px; color: #444444; line-height: 24px; margin-bottom: 14px; padding: 0px; vertical-align: baseline;">
<code style="background-color: #eeeeee; border: 0px; font-style: inherit; font-variant: inherit; line-height: inherit; margin: 0px; padding: 0px 3px; vertical-align: baseline;"><span style="font-family: Trebuchet MS, sans-serif;">$a = Original; $b = Dog; $c = Horse; $dup_a = Cat;</span></code></div>
<a href="https://plus.google.com/u/0/106212648989926698410?rel=author"><span style="font-family: Trebuchet MS, sans-serif;">-By Parthiv Patel</span></a><br />
<div itemscope="" itemtype="http://schema.org/Person">
<div itemprop="name">
<strong><span style="font-family: Trebuchet MS, sans-serif;">Parthiv Patel</span></strong></div>
<div itemscope="" itemtype="http://schema.org/Organization">
<span itemprop="name" style="font-family: Trebuchet MS, sans-serif;">Bhaishri Info Solution</span></div>
<div itemprop="jobtitle">
<span style="font-family: Trebuchet MS, sans-serif;">Sr. PHP Developer</span></div>
<div itemprop="address" itemscope="" itemtype="http://schema.org/PostalAddress">
<div itemprop="streetAddress">
<span style="font-family: Trebuchet MS, sans-serif;">Limdi Chowk, AT PO. Nar, Di. Anand</span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;"><span itemprop="addressLocality">Nar</span>, <span itemprop="addressRegion">Gujarat</span></span></div>
<div itemprop="postalCode">
<span style="font-family: Trebuchet MS, sans-serif;">388150</span></div>
<div itemprop="addressCountry">
<span style="font-family: Trebuchet MS, sans-serif;">India</span></div>
</div>
<div itemprop="email">
<span style="font-family: Trebuchet MS, sans-serif;">pparthiv2412@gmail.com</span></div>
<div itemprop="telephone">
<span style="font-family: Trebuchet MS, sans-serif;">7383343029</span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;">DOB: 12/24/1986</span></div>
</div>
</div>
Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-7280696971627524629.post-5773906484757908822013-06-02T22:21:00.000-07:002013-06-02T22:21:06.560-07:00Object Oriented Programming In PHP-Part-1<div dir="ltr" style="text-align: left;" trbidi="on">
<h4 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif;">Introduction</span></h4>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">On the old site, I started a series of tutorials named "PHP Application Design". I planned for at least three parts, and while I did publish the first two and wrote at least half of part three, I found myself out of time to make it to the finish.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Still dedicated to writing reusable and extensible PHP code and spreading the knowledge, this is a restart of the series, renamed as simply "OO PHP". So:</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Welcome to part one of the "OO PHP" series.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">This article is an overview of what PHP has to offer with respect to OOP, with examples on how to use these concepts.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">If you have wanted to grasp OOP, but haven't come around to learning it, this article is for you. If you've read some "Hello World" in OOP tutorial, gotten familiar with OOP syntax but are interested in learning more, this article is for you too.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">A couple of things have changed in this tutorial. First off, PHP 4 examples and references have been stripped. PHP 4 is dead, let’s look to the future. In that same frame of mind, this tutorial now has some brief coverage of namespaces and late static binding, introduced in PHP 5.3. Finally, the last chapter from the original has been stripped, or rather moved to a future part of the series.</span></div>
<h4 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif;">1. The Very Basics</span></h4>
<h5 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">1.1 A tiny bit of theory</span></h5>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">So what is an object anyway? In a definition proposed by IBM’s Grady Booch in 1991:</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">An object is an instance of a class with the following essential properties:</span></div>
<ul style="background-color: #c1c1c1; color: #333333; line-height: 18px;">
<li><span style="font-family: Trebuchet MS, sans-serif;">Each object has its own identity.</span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;">Each object can have certain behaviour.</span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;">Each object is in a state.</span></li>
</ul>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Let’s do a quick elaboration on these properties.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;"><b>Each object has its own identity.</b><br />
'Having its own identity' implies that even if two objects are structurally the same (of the same class and in the same state), they are still not identical.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;"><b>Each object can have behaviour.</b><br />
This behaviour is used, thus this is also referred to as “offer services”. Basically an object has functions and variables local to that object, referred to as methods and properties (more on that in the next section), which define and influence this behaviour.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;"><b>Each object is in a state.</b><br />
The before mentioned properties (local variables) define the state an object is in. This state can influence the behaviour (the methods act differently depending on the properties).</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">In addition, objects often represent some concept, an object in the more literal sense.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">I know you all can’t stand all this abstract talk and are itching for a code example, so here we go…</span></div>
<h5 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">1.2 Hold on, read this first</span></h5>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Wait. Before I show you ANY code AT ALL, note that in this tutorial I violate a truckload of ‘good practice’ heuristics. This is done to be able to explain you the basics. Take note of the fact that this tutorial is intended to show the features available to you in PHP, it does not promote any actual practice. Don’t worry, I will definitely get to that later.</span></div>
<h5 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">1.3 Absolute basic syntax</span></h5>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Instantiating an (creating a new, unique) object:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="pln" style="color: black;">$someVariable </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">SomeClassDefiningAnObject</span><span class="pun" style="color: #666600;">;</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Executing a function in the object (a method):</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="pln" style="color: black;">$someVariable</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">someMethod</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$someArgumentJustLikeARegularFunction</span><span class="pun" style="color: #666600;">);</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Assigning the return value from a method to a variable:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="pln" style="color: black;">$returnValue </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> $someVariable</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">someMethodThatReturnsSomething</span><span class="pun" style="color: #666600;">();</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Setting and retrieving the current value of a property (a variable local to the object, not unlike an array index):</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="pln" style="color: black;">$someVariable</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">someProperty </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'SomeValue'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
$currentValue </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> $someVariable</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">someProperty</span><span class="pun" style="color: #666600;">;</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Hopefully you now have a basic understanding of what objects are and how to operate on them. Next we’re looking at defining the state and behaviour of objects.</span></div>
<h4 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif;">2 Defining how objects should behave</span></h4>
<h5 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">2.1 Classes</span></h5>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Classes are the (partial) definition of an object. Also referred to as a “object blueprint”, the class defines how the object will look after first instantiation, and how it will behave in response to operating on it. However it also possible to operate within the scope of a class without an instantiation. You will read more about that in the “Scope Resolution Operator” section.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Consider this extremely simple example of a class:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> $hungry </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'hell yeah.'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> eat</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">hungry </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'not so much.'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">$this is a reserved variable name, referring to the current instantiation of the object. By instantiating, we create a new Dog. Don’t mind the public keyword for now.</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="pln" style="color: black;">$dog </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pun" style="color: #666600;">;</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">The initial state of this dog is that it is pretty hungry.</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="pln" style="color: black;">echo $dog</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">hungry</span><span class="pun" style="color: #666600;">;</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Echoes:</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<tt><span style="font-family: Trebuchet MS, sans-serif;">hell yeah.</span></tt></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">So we feed our newly instantiated dog a treat, to modify its state.</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="pln" style="color: black;">$dog</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">eat</span><span class="pun" style="color: #666600;">(</span><span class="str" style="color: #008800;">'cookie'</span><span class="pun" style="color: #666600;">);</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Yep, doggie isn’t as hungry as before:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="pln" style="color: black;">echo $dog</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">hungry</span><span class="pun" style="color: #666600;">;</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Will echo:</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<tt><span style="font-family: Trebuchet MS, sans-serif;">not so much.</span></tt></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Doggie is happy enough, moving on.</span></div>
<h5 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">2.2 Inheritance</span></h5>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Classes can have parent and child classes. When an object is instantiated by name of a child class, PHP looks for parent classes and starts combining the declarations, from the top, to create the initial object. This is called inheritance. It isn’t such a hard concept to grasp: a child inherits anything from its parents and ancestors that isn’t redefined on the way down. If a class lower in the chain has a property or method with the same name as one higher in the chain, the last declaration is used for requests to the object.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">To declare one class as a child of another, use the extends keyword.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Like with most popular languages, in PHP one class can only extend a single other class. An infinite number of classes can be derived from (extending) a single class though.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">A simple example:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Animal</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> $hungry </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'hell yeah.'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> eat</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">hungry </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'not so much.'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">extends</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Animal</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> eat</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food </span><span class="pun" style="color: #666600;">==</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'cookie'</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">hungry </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'not so much.'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">'barf, I only like cookies!'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Method eat is overridden, because doggie only likes cookies. But, because all animals are hungry when you don’t feed them, the initial state of $hungry need not be defined in Dog. The fictional Bird, Cat and Piggy could all extend Animal.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Class Animal is unaware of the fact that it is being extended; there are no references to Dog whatsoever. Say Animal extended another class called LifeForm, and I instantiated Animal, only methods and properties of Animal and LifeForm would be included in the object.</span></div>
<h5 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">2.3 Constructors</span></h5>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Constructors are a way to define the default behaviour (set the default state) upon instantiation. You can, as shown in the previous example, define the default state by setting default values for properties. A constructor is nothing more than a method that is executed when instantiating an object. This is referred to as initializing the object.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">An object isn’t fully initialized, constructed, until the constructor method has completed (if present). A constructor method isn’t required, our previous examples worked just fine without them. Another thing that should be noted is that only the constructor of the class used to instantiate is called automatically, any parent constructors need to be called explicitly.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">PHP 5 uses the __construct magic method. You <tt>can</tt> use the name of the class as well, but this is only for backwards compatibility, and will throw an error if you have E_STRICT error reporting enabled (which you should have).</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">extends</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Animal</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> $breed</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> __construct</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$breed</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">breed </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> $breed</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> eat</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food </span><span class="pun" style="color: #666600;">==</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'cookie'</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">hungry </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'not so much.'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">'barf, I only like cookies!'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Instantiating a Dog requires us to specify it’s breed. The property breed is assigned a new value by cause of this initialization (previously NULL), and we have a Dog which initial state specifies it’s breed:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="pln" style="color: black;">$dog </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pun" style="color: #666600;">(</span><span class="str" style="color: #008800;">'Golden Retriever'</span><span class="pun" style="color: #666600;">);</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">We could change its breed afterwards if we’d like:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="pln" style="color: black;">$dog</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">breed </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'Bloodhound'</span><span class="pun" style="color: #666600;">;</span></span></pre>
<h5 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">2.4 Scope Resolution Operator</span></h5>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Officially called Paamayim Nekudotayim (Hebrew for double colon, now you know what the parser is talking about when you get errors), the scope resolution operator (::) allows you to perform static calls to methods and class members.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Static methods can be called without instantiation of an object. This can be useful both inside a class declaration (within an object hierarchy) as outside of it.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">After an object is created, some reference to the overwritten methods and properties remains intact. One can access these methods from within the object statically (no new instantiation is required, yet the object from within you are operating is still affected.).</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Animal</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> $hungry </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'hell yeah.'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> __construct</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">'I am an animal.'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> eat</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">hungry </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'not so much.'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">extends</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Animal</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> $breed</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> __construct</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$breed</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">breed </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> $breed</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="typ" style="color: #660066;">Animal</span><span class="pun" style="color: #666600;">::</span><span class="pln" style="color: black;"> __construct</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> eat</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food </span><span class="pun" style="color: #666600;">==</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'cookie'</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="typ" style="color: #660066;">Animal</span><span class="pun" style="color: #666600;">::</span><span class="pln" style="color: black;">eat</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">'barf, I only like cookies!'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
$dog </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pun" style="color: #666600;">(</span><span class="str" style="color: #008800;">'Rotweiler'</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;">
$dog</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">eat</span><span class="pun" style="color: #666600;">(</span><span class="str" style="color: #008800;">'cookie'</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;">
echo $dog</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">hungry</span><span class="pun" style="color: #666600;">;</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Dog is using its parent’s method eat to refer to the declaration of eat that was overwritten by its own declaration of eat. You need not specify the specific class name like in the above example to refer to the last declaration of a method (or property), the parent keyword will point to that reference:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="pln" style="color: black;">parent</span><span class="pun" style="color: #666600;">::</span><span class="pln" style="color: black;">eat</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food</span><span class="pun" style="color: #666600;">);</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Should you have multiple levels of inheritance, and want to address a declaration other than the one last defined, you’ll have to specify the class like in the above example class.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">The constructor of parent classes is called upon instantiation, unless it is overridden. We override __construct(), so if we desire to run a parent constructor, we have to call it explicitly:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="typ" style="color: #660066;">Animal</span><span class="pun" style="color: #666600;">::</span><span class="pln" style="color: black;">__construct</span><span class="pun" style="color: #666600;">();</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Trying to call a method statically which has references to object specific variables (makes use of $this) from outside of the object, will throw an error:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="typ" style="color: #660066;">Dog</span><span class="pun" style="color: #666600;">::</span><span class="pln" style="color: black;">eat</span><span class="pun" style="color: #666600;">(</span><span class="str" style="color: #008800;">'cookie'</span><span class="pun" style="color: #666600;">);</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Result:</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<tt><span style="font-family: Trebuchet MS, sans-serif;">Fatal error: Using $this when not in object context</span></tt></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">PHP 5 features static class members. It requires you to define what methods and properties can be used statically. Static properties work the same as regular static variables, if you are unfamiliar with static variables, have a thorough read on Variable Scope in the manual.</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">static</span><span class="pln" style="color: black;"> $hungry </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'hell yeah.'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">static</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> eat</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food </span><span class="pun" style="color: #666600;">==</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'cookie'</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">self</span><span class="pun" style="color: #666600;">::</span><span class="pln" style="color: black;">$hungry </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'not so much.'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">'barf, I only like cookies!'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="typ" style="color: #660066;">Dog</span><span class="pun" style="color: #666600;">::</span><span class="pln" style="color: black;">eat</span><span class="pun" style="color: #666600;">(</span><span class="str" style="color: #008800;">'cookie'</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;">
echo </span><span class="typ" style="color: #660066;">Dog</span><span class="pun" style="color: #666600;">::</span><span class="pln" style="color: black;">$hungry</span><span class="pun" style="color: #666600;">;</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Note the self keyword. It is simply referring to this class declaration. Like with the parent keyword, alternatively one could use the actual name of the class (Dog).</span></div>
<h4 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif;">2.5 Abstract Classes</span></h4>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Abstract classes are, well, abstract. An abstract class isn’t intended to be instantiated, but to serve as a parent to other classes, partly dictating how they should behave. Abstract classes can have abstract methods, these are required in the child classes.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Abstract classes can be used to enforce a certain interface.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">An example:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="pln" style="color: black;">abstract </span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Animal</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> $hungry </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'hell yeah.'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
abstract </span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> eat</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">extends</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Animal</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> eat</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food </span><span class="pun" style="color: #666600;">==</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'cookie'</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">hungry </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'not so much.'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">'barf, I only like cookies!'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
$dog </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
echo $dog</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">hungry</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"> </span><span class="com" style="color: #880000;">//echoes "hell yeah."</span><span class="pln" style="color: black;">
$dog</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">eat</span><span class="pun" style="color: #666600;">(</span><span class="str" style="color: #008800;">'peanut'</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"> </span><span class="com" style="color: #880000;">//echoes "barf, I only like cookies!"</span></span></pre>
<h4 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif;">3 Beyond the Absolute Basics</span></h4>
<h5 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">3.1 Object Handles</span></h5>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">In PHP5, objects are defined by handles, not unlike resource type variables.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Passing an object to a function doesn’t make a copy of it. Have a read on References Explained if you’re still a little confused by this.</span></div>
<h5 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">3.2 Interfaces</span></h5>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">PHP5 features interfaces. Not to be confused with interfaces in the more general sense, the interface keyword creates an entity that can be used to enforce a common interface upon classes without having to extend them like with abstract classes. Instead an interface is implemented.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Interfaces are different from abstract classes. For one, they’re not actually classes. They don’t define properties, and they don’t define any behaviour. The methods declared in an interface must be declared in classes that implement it.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Because an interface in the more general sense is a definition of how an object interacts with other code, all methods must be declared public (see section on visibility in this chapter). Using abstract classes, an abstract method can have any visibility, but the extending classes must have their implementations use the same (or weaker) visibility. Implementing an interface adds the methods as abstract methods to the subject class, failure to implement it will result in an error like the following:</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<tt><span style="font-family: Trebuchet MS, sans-serif;">Fatal error: Class SomeConcreteClass contains n abstract method(s) and must therefore be declared abstract or implement the remaining methodsYes, abstract classes can implement interfaces.</span></tt></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Interfaces can be looked upon as a contract, a certificate of compliance if you will. Other code is guaranteed that a class implementing it will use certain methods to interact.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Enough babbling, let’s see a code example:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">interface</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Animal</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> eat</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">interface</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Mammal</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> giveBirth</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">implements</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Animal</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Mammal</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> $gender </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'male'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> eat</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food </span><span class="pun" style="color: #666600;">==</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'cookie'</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">hungry </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'not so much.'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">'barf, I only like cookies!'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> giveBirth</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">gender </span><span class="pun" style="color: #666600;">==</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'male'</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">'I can\'t, I am a boy :P'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">'I\'m not even pregnant yet.'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Doggie implements 2 interfaces, both Animal and Mammal. You can implement as many interfaces as you like.</span></div>
<h5 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">3.3 Autoload</span></h5>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">A very convenient feature, __autoload allows you to get rid of all those annoying includes that need to be managed. This magic function will execute whenever a class or interface is referenced that hasn’t been defined. That gives you the opportunity to include it.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Here’s a simple example of how that might look using the standard PEAR naming scheme (the segments between underscores become directory names, bar the last, which becomes the filename):</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> __autoload</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$className</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$file </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> str_replace</span><span class="pun" style="color: #666600;">(</span><span class="str" style="color: #008800;">'_'</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> DIRECTORY_SEPARATOR</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> $className</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'.php'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(!</span><span class="pln" style="color: black;">file_exists</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$file</span><span class="pun" style="color: #666600;">))</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">return</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">false</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
require_once $file</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> Foo_Bar</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;"> </span><span class="com" style="color: #880000;">//Maps to ‘Foo/Bar.php’</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">We don’t really need require_once, because once the file is included, __autoload will not trigger on that class or interface reference again.</span></div>
<h5 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">3.4 Destructors</span></h5>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Destructors are another type of magic methods. Indicated by __destruct, these methods are called when all references to their objects are removed. This includes explicit un-setting and script shutdown. A quick example of this:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Example</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">private</span><span class="pln" style="color: black;"> $_name</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> __construct</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$name</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">_name </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> $name</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> __destruct</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">"Destructing object '$this->_name'."</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;"> PHP_EOL</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
$objectOne </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Example</span><span class="pun" style="color: #666600;">(</span><span class="str" style="color: #008800;">'Object one'</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;">
$objectTwo </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Example</span><span class="pun" style="color: #666600;">(</span><span class="str" style="color: #008800;">'Object two'</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;">
unset</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$objectOne</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">'Script still running.'</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;"> PHP_EOL</span><span class="pun" style="color: #666600;">;</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">This echoes:</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<tt><span style="font-family: Trebuchet MS, sans-serif;"><br />
Destructing object 'Object one'.<br />
Script still running.<br />
Destructing object 'Object two'.</span></tt></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Object one is destructed when we explicitly unset it, object two just before the script execution is completed. An object’s destructor is always executed (or rather ‘should be’: don’t rely on this mechanism too much). Note that if we had created a second object from within class Example, it’s destructor would also have been executed, as it would have removed all references to the embedded object.</span></div>
<h5 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">3.5 Visibility</span></h5>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">PHP 5 allows you to declare the visibility of methods and properties. There are three types of visibility: public, protected and private.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;"><b>Public</b><br />
Public methods and properties are visible (accessible) to any code that queries them. No accessibility restrictions are applied. In PHP 5, methods without visibility declaration are assumed public, the visibility declaration is required, excluding static class members (if you don’t include it, ‘public’ is assumed). Class constants are always globally available.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;"><b>Protected</b><br />
Requests are only allowed from within the objects blueprint (that includes parent and child classes). Meaning the following would fail:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Teeth</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">protected</span><span class="pln" style="color: black;"> $_colour </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'white'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> stain</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">_colour </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'yellow'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> $teeth</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> __construct</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">teeth </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Teeth</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> eat</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food </span><span class="pun" style="color: #666600;">==</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'cookie'</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">hungry </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'not so much.'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="com" style="color: #880000;">//Attempt to turn teeth green:</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">teeth</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">_colour </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'green'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">'barf, I only like cookies!'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
$dog </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pun" style="color: #666600;">();</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Produces:</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<tt><span style="font-family: Trebuchet MS, sans-serif;">Fatal error: Cannot access protected property Teeth::$_colour</span></tt></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Should Teeth have been a parent class of Dog instead of a member object (class Dog extends Teeth - don’t do that), $colour would have been accessible though $this, but also statically by Teeth::$_colour (or parent::$_colour).</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;"><b>Private</b><br />
Access is limited to the declaring class (the class the property is declared in). No external access whatsoever is allowed.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">One thing that should be noted when using protected or private properties, is that if you attempt to assign a value to a property that isn’t visible to the class you are doing it in, you will be creating a new property instead of resetting the original. Keep that in mind when you get unexpected values: check the property’s visibility.</span></div>
<h5 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">3.6 Class Constants</span></h5>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">We already covered using static class members, there is another type of class member, which we haven’t covered: class constants.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">I am assuming you are already familiar with regular constants, and are aware of how they differ from variables.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Class constants are just regular constants, declared in a class. It’s reference is obtained through the class scope. Because constants are unchangeable, they are independent of any state the object could be in. Therefore they can only be called statically.</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">const</span><span class="pln" style="color: black;"> NUMBER_OF_LEGS </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'4'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> __construct</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">'I have '</span><span class="pun" style="color: #666600;">.</span><span class="kwd" style="color: #000088;">self</span><span class="pun" style="color: #666600;">::</span><span class="pln" style="color: black;">NUMBER_OF_LEGS.</span><span class="str" style="color: #008800;">' legs,
and you can\'t take that away from me!'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
$dog </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pun" style="color: #666600;">();</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Both $dog->NUMBER_OF_LEGS and $this->NUMBER_OF_LEGS would have PHP looking for a non-existent object property: $NUMBER_OF_LEGS.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Class constants are always publicly accessible. Any code can call Dog::NUMBER_OF_LEGS.</span></div>
<h5 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">3.7 Type Hinting</span></h5>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">PHP 5 features type hinting as a means to limit the types of variables that a method will accept as an argument. Let’s kick off with a simple example:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Rabbit</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Feeder</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> feedRabbit</span><span class="pun" style="color: #666600;">(</span><span class="typ" style="color: #660066;">Rabbit</span><span class="pln" style="color: black;"> $rabbit</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> $food</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$rabbit</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">eat</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
$dog </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
$feeder </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Feeder</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
$feeder</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">feedRabbit</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$dog</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'broccoli'</span><span class="pun" style="color: #666600;">);</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Attempting to use an instance of Dog with the feedRabbit method results in the following error:</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<tt><span style="font-family: Trebuchet MS, sans-serif;">Fatal error: Argument 1 passed to Feeder::feedRabbit() must be an instance of Rabbit</span></tt></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">However, type hinting allows a more generic use. Consider the following example:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Animal</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Feeder</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> feedAnimal</span><span class="pun" style="color: #666600;">(</span><span class="typ" style="color: #660066;">Animal</span><span class="pln" style="color: black;"> $animal</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> $food</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$animal</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">eat</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">extends</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Animal</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> eat</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$food </span><span class="pun" style="color: #666600;">==</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'cookie'</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">hungry </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'not so much.'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">'barf, I only like cookies!'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
$dog </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
$feeder </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Feeder</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
$feeder</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">feedAnimal</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$dog</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'broccoli'</span><span class="pun" style="color: #666600;">);</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Because $dog is not only a Dog, but also an Animal, the requirement is met. Doggie doesn’t like broccoli (who does?), but that is besides the point. Currently PHP only supports type hinting with objects and arrays.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;"><b>Note:</b> since PHP 5.2, failing type hinting requirements result in a E_RECOVERABLE_ERROR type error, not an immediate fatal error.</span></div>
<h5 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">3.8 Exceptions</span></h5>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">PHP 5 introduces the concept of exceptions to PHP. An exception is not an error, an uncaught exception is (a fatal error).</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Using exceptions you will need the following keywords: try, throw and catch. PHP 5 has it’s build-in Exception class, which you can extend.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">You can have multiple catch blocks following a try block. PHP will execute the first catch block that matches the type of the exception thrown. If no exception is thrown or none of the catch declarations match the thrown exception type, no catch blocks are executed.</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">LiarException</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">extends</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Exception</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">try</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$doggy</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">talk</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">==</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'Doggie likes broccoli.'</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">throw</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">LiarException</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">
</span><span class="str" style="color: #008800;">'Doggie is a big fat liar. He only likes cookies.'</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">throw</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Exception</span><span class="pun" style="color: #666600;">(</span><span class="str" style="color: #008800;">'Just because we can.'</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">'An exception was thrown, so this will never print...'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">catch</span><span class="pun" style="color: #666600;">(</span><span class="typ" style="color: #660066;">LiarException</span><span class="pln" style="color: black;"> $e</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">"Somebody lied about something: {$e->getMessage()}'"</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">catch</span><span class="pun" style="color: #666600;">(</span><span class="typ" style="color: #660066;">Exception</span><span class="pln" style="color: black;"> $e</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">"Somebody threw an exception: {$e->getMessage()}'"</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">In the example above, the code in the try block is executed until an exception is thrown. If an exception is thrown, the code in the corresponding catch block is executed. As noted, PHP executes the FIRST matching catch block. So if we switched the catch blocks, the first block would be executed, even though the second is a ‘closer match’.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">If there isn’t a corresponding catch block, the exception is ‘falls through’. Assuming the call to the code is not itself contained in a try block, the exception is uncaught, resulting in a fatal error.</span></div>
<h5 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">3.9 The Final Keyword</span></h5>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">The final keyword indicates that the declaration following it is final, no child class will be able to redefine it. One can declare both a single method or a whole class as final. If the whole class is declared final, it becomes un-extendable: no child classes are allowed.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">There really isn’t much more to it, apply it only if you are absolutely sure you don’t want that specific class or method extended or re-declared respectively.</span></div>
<h5 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">3.10 More Magic Methods</span></h5>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Aside from __construct, __destruct, there are quite a few more magic methods:</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Overloading</span></div>
<ul style="background-color: #c1c1c1; color: #333333; line-height: 18px;">
<li><span style="font-family: Trebuchet MS, sans-serif;">__call</span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;">__get</span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;">__set</span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;">__isset</span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;">__unset</span></li>
</ul>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Object cloning</span></div>
<ul style="background-color: #c1c1c1; color: #333333; line-height: 18px;">
<li><span style="font-family: Trebuchet MS, sans-serif;">__clone</span></li>
</ul>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Serialization</span></div>
<ul style="background-color: #c1c1c1; color: #333333; line-height: 18px;">
<li><span style="font-family: Trebuchet MS, sans-serif;">__sleep</span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;">__wakeup</span></li>
</ul>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Other</span></div>
<ul style="background-color: #c1c1c1; color: #333333; line-height: 18px;">
<li><span style="font-family: Trebuchet MS, sans-serif;">__toString</span></li>
<li><span style="font-family: Trebuchet MS, sans-serif;">__setState</span></li>
</ul>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;"><b>3.10.1 Object Overloading</b><br />
If you’re coming from a different OO language, the term ‘overloading’ likely has a very different meaning to you: defining different method with the same name having different signatures. This has nothing to do with that.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Object overloading in PHP refers to the mechanism where a call to a method or property will ‘overload’ the call to a different property or method. The call ultimately made can depend on the type of the arguments or the context.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">These magic methods allow you catch calls to methods and properties that haven’t been defined, because you didn’t know (or didn’t want to specify) the exact name.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">The magic methods are executed only if the object doesn’t have the method or property declared.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">The following example class uses __set to check if an embedded object does have the property requested, before creating a new property for the parent object.</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">DomXml</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">private</span><span class="pln" style="color: black;"> $_domDoc</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> __construct</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">_domDoc </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">DOMDocument</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">private</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> __set</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$name</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> $value</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">property_exists</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">_domDoc</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> $name</span><span class="pun" style="color: #666600;">))</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">_domDoc</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">$name </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> $value</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">$name </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> $value</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">An example __call use:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">private</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> __call</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$name</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> $params</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">method_exists</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">_doc</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> $name</span><span class="pun" style="color: #666600;">))</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">return</span><span class="pln" style="color: black;"> call_user_func_array</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">
aray</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">_doc</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> $name</span><span class="pun" style="color: #666600;">),</span><span class="pln" style="color: black;"> $params
</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">throw</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">DomXmlException</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">
</span><span class="str" style="color: #008800;">"Call to undeclared method '$name'"</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Methods __get, __isset and __unset have similar uses.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;"><b>3.10.2 Object cloning</b><br />
Because in PHP 5 objects use handles, if you would want to create a copy of an object you have to explicitly indicate so with the clone keyword.</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="pln" style="color: black;">$obj </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Example</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
$objectCopy </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> clone $obj</span><span class="pun" style="color: #666600;">;</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Above gives you a new object that is an exact copy of $obj in the state it was when copied.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">The __clone method is triggered by this clone keyword. This allows you, for example, to ensure embedded objects are also cloned (otherwise they would this use the same object handle for the embedded objects).</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">The following example illustrates this:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Teeth</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> $colour </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'white'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> $teeth</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> __construct</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">teeth </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Teeth</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
$Lassie </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
$Snoopy </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> clone $Lassie</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
$Snoopy</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">teeth</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">colour </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'green'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
echo $Snoopy</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">teeth</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">colour </span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;"> PHP_EOL</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
echo $Lassie</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">teeth</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">colour </span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;"> PHP_EOL</span><span class="pun" style="color: #666600;">;</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">That will echo:</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<tt><span style="font-family: Trebuchet MS, sans-serif;"><br />
green<br />
green</span></tt></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Changing the property colour to green on $Snoopy’s teeth, also changes $Lassie’s teeth to green, because they share the same teeth. Imagine that, two dogs attached at the mouth…</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">To give Lassie’s clone Snoopy its own set of teeth, we can use the __clone method:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> $teeth</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> __construct</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">teeth </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Teeth</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> __clone</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">teeth </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> clone $this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">teeth</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Now it will output:</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<tt><span style="font-family: Trebuchet MS, sans-serif;"><br />
green<br />
white</span></tt></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Voila, a cloned Dog now has its own teeth.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;"><b>3.10.3 Serialization</b><br />
Resource handles don’t serialize. If one of your properties has a resource handle as its value, for example a file handle or database connection, You can use the __wakeup magic to re-establish these handles. This method will be called when you call unserialize($serializedObject). The __sleep method is invoked when you serialize an object, and is expected to return an array of property names to be included in the serialization. This allows you to exclude certain properties.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;"><b>3.10.4 Other</b><br />
Other methods that don’t fit in the previous categories.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">__toString: This magic method can be used to define how an object will present itself if the whole object is treated as a string.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Example:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> __toString</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">return</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'I am Dog.'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
$dog </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
echo $dog</span><span class="pun" style="color: #666600;">;</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Result:</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<tt><span style="font-family: Trebuchet MS, sans-serif;">I am Dog.</span></tt></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Note that older versions of PHP 5 didn’t support calling __toString() when embedding or concatenating in a string. Currently, this will work as well:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="pln" style="color: black;">$dog </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Dog</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">"Doggie says: $dog"</span><span class="pun" style="color: #666600;">;</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;"><br />
__set_state: This is a static method that can be used to reinitialize an object after being “flattened” by var_export.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;"><b>3.11 Object Iteration</b><br />
PHP allows objects to be iterated, all properties visible to the scope the iteration is requested from are used. Example of this with a foreach loop:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ExampleParent</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">protected</span><span class="pln" style="color: black;"> $propertyOne </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'value1'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> $propertyTwo </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'value2'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Example</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">extends</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ExampleParent</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">private</span><span class="pln" style="color: black;"> $propertyThree </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'value3'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> __construct</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">"Internal iteration of Example:"</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;"> PHP_EOL</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">foreach</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$this </span><span class="kwd" style="color: #000088;">as</span><span class="pln" style="color: black;"> $property </span><span class="pun" style="color: #666600;">=></span><span class="pln" style="color: black;"> $value</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">"Property '$property' => '$value' "</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;"> PHP_EOL</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
echo PHP_EOL</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
$example </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Example</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">"External iteration of Example:"</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;"> PHP_EOL</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">foreach</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$example </span><span class="kwd" style="color: #000088;">as</span><span class="pln" style="color: black;"> $property </span><span class="pun" style="color: #666600;">=></span><span class="pln" style="color: black;"> $value</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">"Property '$property' => '$value' "</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;"> PHP_EOL</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
echo PHP_EOL</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
$exampleParent </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ExampleParent</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">"External iteration of ExampleParent:"</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;"> PHP_EOL</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">foreach</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$exampleParent </span><span class="kwd" style="color: #000088;">as</span><span class="pln" style="color: black;"> $property </span><span class="pun" style="color: #666600;">=></span><span class="pln" style="color: black;"> $value</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">"Property '$property' => '$value' "</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;"> PHP_EOL</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Output:</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<tt><span style="font-family: Trebuchet MS, sans-serif;"><br />
Internal iteration of Example:<br />
Property 'propertyThree' => 'value3'<br />
Property 'propertyOne' => 'value1'<br />
Property 'propertyTwo' => 'value2'</span></tt></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<tt><span style="font-family: Trebuchet MS, sans-serif;">External iteration of Example:<br />
Property 'propertyTwo' => 'value2'</span></tt></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<tt><span style="font-family: Trebuchet MS, sans-serif;">External iteration of ExampleParent:<br />
Property 'propertyTwo' => 'value2'</span></tt></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;"><tt></tt></span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">You’ll notice that the external iteration doesn’t list the private and protected properties.</span></div>
<h4 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif;">4. Hot off The Press Features</span></h4>
<h5 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">4.1 Namespaces</span></h5>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">PHP 5.3 and up offers namespaces which allows you to give your classes logical names without resorting to really long winded names like the ones caused by the PEAR naming standard.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Simply put, the PEAR naming standard defines pseudo namespaces, which map to a location on the file system (see section Autoload). A name like the following:</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Application_Input_Validate_PhoneNumber_Us</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Would map to Application/Input/Validate/PhoneNumber/Us.php</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Sometimes these names get way bigger than this. Here’s a different example, from Zend Framework:</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Zend_Controller_Action_Helper_AutoComplete_Abstract</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">It can get even bigger.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">PHP 5.3+ namespaces solves this by creating aliases.</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">namespace</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Application</span><span class="pun" style="color: #666600;">::</span><span class="typ" style="color: #660066;">Input</span><span class="pun" style="color: #666600;">::</span><span class="typ" style="color: #660066;">Validate</span><span class="pun" style="color: #666600;">::</span><span class="typ" style="color: #660066;">PhoneNumber</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Us</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Now, I could call this:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="pln" style="color: black;">$validator </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Application</span><span class="pun" style="color: #666600;">::</span><span class="typ" style="color: #660066;">Input</span><span class="pun" style="color: #666600;">::</span><span class="typ" style="color: #660066;">Validate</span><span class="pun" style="color: #666600;">::</span><span class="typ" style="color: #660066;">PhoneNumber</span><span class="pun" style="color: #666600;">::</span><span class="typ" style="color: #660066;">Us</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$arg</span><span class="pun" style="color: #666600;">);</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">But that can hardly be called an improvement, can it?</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Instead, knowing that I am going to use a phone number validator, I can create a namespace alias:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">use</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Application</span><span class="pun" style="color: #666600;">::</span><span class="typ" style="color: #660066;">Input</span><span class="pun" style="color: #666600;">::</span><span class="typ" style="color: #660066;">Validate</span><span class="pun" style="color: #666600;">::</span><span class="typ" style="color: #660066;">PhoneNumber</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">as</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">PhoneValidators</span><span class="pln" style="color: black;">
$validator </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">PhoneValidators</span><span class="pun" style="color: #666600;">::</span><span class="typ" style="color: #660066;">Us</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$arg</span><span class="pun" style="color: #666600;">);</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Better, no? It saves me having to refer to the fully quantified class name, and I can select the right validator class in my client code without littering it with repeated lengthy namespace selections.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">I can also create an alias for a class name. For example:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">use</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Framework</span><span class="pun" style="color: #666600;">::</span><span class="typ" style="color: #660066;">Controller</span><span class="pun" style="color: #666600;">::</span><span class="typ" style="color: #660066;">Response</span><span class="pun" style="color: #666600;">::</span><span class="typ" style="color: #660066;">Http</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">HttpResponse</span><span class="pln" style="color: black;">
$response </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">HttpResponse</span><span class="pun" style="color: #666600;">();</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">The fully quantified name of the class includes the namespace. Hence, calling var_dump on the above $response object would output something like the following:</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<tt><span style="font-family: Trebuchet MS, sans-serif;"><br />
object(Framework::Controller::Response::Http)#1 (0) {</span></tt></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<tt><span style="font-family: Trebuchet MS, sans-serif;">} </span></tt></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">This allows us to mend our __autoload function to load classes in a namespace:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> __autoload</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$className</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$file </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> str_replace</span><span class="pun" style="color: #666600;">(</span><span class="str" style="color: #008800;">'::'</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> DIRECTORY_SEPARATOR</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> $className</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">'.php'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(!</span><span class="pln" style="color: black;">file_exists</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">$file</span><span class="pun" style="color: #666600;">))</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">return</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">false</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
require_once $file</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span></span></pre>
<h5 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">4.2 Late static binding</span></h5>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">In PHP 5.2, you can already do this:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="pln" style="color: black;">abstract </span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ParentClass</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">static</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> foo</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">'blah'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ImplementationClass</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">extends</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ParentClass</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{}</span><span class="pln" style="color: black;">
</span><span class="typ" style="color: #660066;">ImplementationClass</span><span class="pun" style="color: #666600;">::</span><span class="pln" style="color: black;">foo</span><span class="pun" style="color: #666600;">();</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Static methods are inherited. But without late static binding, ParentClass will not be able to invoke any static methods of ImplementationClass, like in this non-static example:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="pln" style="color: black;">abstract </span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ParentClass</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> foo</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
$this</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">meh</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ImplementationClass</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">extends</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ParentClass</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> meh</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">'blah'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
$impl </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ImplementationClass</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
$impl</span><span class="pun" style="color: #666600;">-></span><span class="pln" style="color: black;">foo</span><span class="pun" style="color: #666600;">();</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">If we wanted meh to be static, it would be tempting to try this:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="pln" style="color: black;">abstract </span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ParentClass</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> foo</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">self</span><span class="pun" style="color: #666600;">::</span><span class="pln" style="color: black;">meh</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ImplementationClass</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">extends</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ParentClass</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">static</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> meh</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">'blah'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="typ" style="color: #660066;">ImplementationClass</span><span class="pun" style="color: #666600;">::</span><span class="pln" style="color: black;">foo</span><span class="pun" style="color: #666600;">();</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">But self refers to the current class scope, ParentClass in this case, so we produce this error:</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<tt><span style="font-family: Trebuchet MS, sans-serif;">Fatal error: Call to undefined method ParentClass::meh()</span></tt></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">In PHP5.3+, self still points to the current class reference. To make the above scenario possible, a new use is given to the static keyword:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="pln" style="color: black;">abstract </span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ParentClass</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">static</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> foo</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">static</span><span class="pun" style="color: #666600;">::</span><span class="pln" style="color: black;">meh</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ImplementationClass</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">extends</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ParentClass</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">static</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> meh</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">'blah'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="typ" style="color: #660066;">ImplementationClass</span><span class="pun" style="color: #666600;">::</span><span class="pln" style="color: black;">foo</span><span class="pun" style="color: #666600;">();</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Above will echo ‘blah’ on PHP5.3+.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">But, all is not as simple as it seems. The static keyword doesn’t take inheritance into account, like $this does. Instead it tries to resolve the correct call.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">The following code will fail:</span></div>
<pre class="prettyprint lang-php" style="background-color: #dddddd; border: 1px solid rgb(136, 136, 136); color: #333333; line-height: 18px; margin: 10px 20px 5px; max-height: 400px; overflow: auto; padding: 2px;"><span style="font-family: Trebuchet MS, sans-serif;"><span class="pln" style="color: black;">abstract </span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ParentClass</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">static</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">delegate</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">static</span><span class="pun" style="color: #666600;">::</span><span class="pln" style="color: black;">meh</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">class</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ImplementationClass</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">extends</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ParentClass</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">static</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> meh</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
echo </span><span class="str" style="color: #008800;">'blah'</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="kwd" style="color: #000088;">public</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">static</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">function</span><span class="pln" style="color: black;"> foo</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;">
parent</span><span class="pun" style="color: #666600;">::</span><span class="kwd" style="color: #000088;">delegate</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;">
</span><span class="typ" style="color: #660066;">ImplementationClass</span><span class="pun" style="color: #666600;">::</span><span class="pln" style="color: black;">foo</span><span class="pun" style="color: #666600;">();</span></span></pre>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">Because 'parent' resolves to ParentClass, 'static' in delegate() resolves to ParentClass as well. But ParentClass doesn’t have a method called ‘meh’; the dreaded fatal error we got before is inescapable. You’ll get similar results trying it with multiple levels of inheritance, a fully resolved method call (ParentClass::delegate()), or with static properties instead of methods.</span></div>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">In summary: if you want to use this new feature, be very aware of its limitations.</span></div>
<h5 style="background-color: #c1c1c1; color: #245b8b; line-height: 18px; margin: 0px; padding: 10px 0px 5px 20px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">5 In conclusion</span></h5>
<div style="background-color: #c1c1c1; color: #333333; line-height: 18px; padding: 10px 20px 5px;">
<span style="font-family: Trebuchet MS, sans-serif;">If you have any questions regarding this tutorial. If you want to comment you can do so below.</span></div>
<a href="https://plus.google.com/u/0/106212648989926698410?rel=author"><span style="font-family: Trebuchet MS, sans-serif;">-By Parthiv Patel</span></a><br />
<div itemscope="" itemtype="http://schema.org/Person">
<div itemprop="name">
<strong><span style="font-family: Trebuchet MS, sans-serif;">Parthiv Patel</span></strong></div>
<div itemscope="" itemtype="http://schema.org/Organization">
<span itemprop="name" style="font-family: Trebuchet MS, sans-serif;">Bhaishri Info Solution</span></div>
<div itemprop="jobtitle">
<span style="font-family: Trebuchet MS, sans-serif;">Sr. PHP Developer</span></div>
<div itemprop="address" itemscope="" itemtype="http://schema.org/PostalAddress">
<div itemprop="streetAddress">
<span style="font-family: Trebuchet MS, sans-serif;">Limdi Chowk, AT PO. Nar, Di. Anand</span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;"><span itemprop="addressLocality">Nar</span>, <span itemprop="addressRegion">Gujarat</span></span></div>
<div itemprop="postalCode">
<span style="font-family: Trebuchet MS, sans-serif;">388150</span></div>
<div itemprop="addressCountry">
<span style="font-family: Trebuchet MS, sans-serif;">India</span></div>
</div>
<div itemprop="email">
<span style="font-family: Trebuchet MS, sans-serif;">pparthiv2412@gmail.com</span></div>
<div itemprop="telephone">
<span style="font-family: Trebuchet MS, sans-serif;">7383343029</span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;">DOB: 12/24/1986</span></div>
</div>
</div>
Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-7280696971627524629.post-90455925942772256032013-06-02T22:00:00.005-07:002013-06-02T22:00:45.345-07:00Website Development: 6 Must-have Pages<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Trebuchet MS, sans-serif;"><b style="background-color: white; color: #1e1e20; line-height: 18px;">#1. Home Page</b><span style="background-color: white; color: #1e1e20; line-height: 18px;">: Purpose of page = Get user to take action.</span></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">In today's short attention span, Web 2.0 world, there's no time for fluff.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">Your Home Page is the gravity point of your site and your shot at convincing the end-user to stay on board for more than a few seconds.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">Keep it clean, clear and to the point.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">* If you're building a web service, let users "use", "test drive", or at least "watch a demo video" on your site's home page. Forget about requiring registration first.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">* If your website is promoting a product/service, include information about (a) What you are selling, (b) Why it is the best product/service for your prospect, (c) Answers to common questions + Credibility boosters, and (d) Call to action. </span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="font-family: Trebuchet MS, sans-serif;"><b style="background-color: white; color: #1e1e20; line-height: 18px;">#2. About us Page: </b><span style="background-color: white; color: #1e1e20; line-height: 18px;">Purpose of page = Build credibility.</span></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">The "About us" page is the second most important page of your website.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">Our experience taught us first time users always click on the "About us" page, to learn more about the company, BEFORE they complete an order, BEFORE they signup and BEFORE they decide to trust your company.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">Don't even think about using a template for this page. Be honest, include personal information about the founders, how and why the website was launched and what is the vision behind the site.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">Include information about your company's geographic location, years in business, business model and best way to get in touch with you (Yes, you want all this information on the 'About us' page, even if you have a 'Contact us' page).</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="font-family: Trebuchet MS, sans-serif;"><b style="background-color: white; color: #1e1e20; line-height: 18px;">#3. FAQ Page: </b><span style="background-color: white; color: #1e1e20; line-height: 18px;">Purpose of page = Close the sale.</span></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">The user checked out your "home page" and they read the "about us" page. They're still not sure this is the right product/service for them, so they turn to your FAQ page.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">Don't have an FAQ page? You just lost them.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">The single purpose of your FAQ page is to answer any questions your prospect might have, further re-iterating why your product/service is a great fit.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><b style="background-color: white; color: #1e1e20; line-height: 18px;"><br />
#4. Privacy Policy Page</b><span style="background-color: white; color: #1e1e20; line-height: 18px;">: Purpose of page = Reassurance.</span></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">Straightforward, but definitely a must have. </span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">Users are going to skim through this page to ensure there are no gotchas, </span><br />
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">associated with using your product/service.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="font-family: Trebuchet MS, sans-serif;"><b style="background-color: white; color: #1e1e20; line-height: 18px;">#5. Terms and Conditions Page</b><span style="background-color: white; color: #1e1e20; line-height: 18px;">: Purpose of page = Protect yourself.</span></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">Don't underestimate this one. Make your T&C page as detailed as possible, so that you protect your interests. It's a good idea to have your legal team write this page for you.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">If you're on a tight budget and can't afford a legal team, search for a site that is similar to yours, study their T&C and write yours accordingly.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="font-family: Trebuchet MS, sans-serif;"><b style="background-color: white; color: #1e1e20; line-height: 18px;">#6. Contact us Page</b><span style="background-color: white; color: #1e1e20; line-height: 18px;">: Purpose of page = Reinforce Credibility.</span></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">The "Contact us" page is only on this list because not having a "contact us" page is a major red flag. </span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">No need to go crazy with your contact page. Include more than one form of contact (i.e. Phone and Email, or Email and Snail mail) and make it very clear that your company is always available to answer any questions, comments or concerns.</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">--</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">Every single one of the web sites and landing pages we create, include these six must-have pages. </span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><br style="background-color: white; color: #1e1e20; line-height: 18px;" /></span>
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">If your sites are missing one or more of the 6 must-have pages, go ahead and add them now. You'll thank me later.</span></div>
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span>
<a href="https://plus.google.com/u/0/106212648989926698410?rel=author"><span style="font-family: Trebuchet MS, sans-serif;">-By Parthiv Patel</span></a><br />
<div itemscope="" itemtype="http://schema.org/Person">
<div itemprop="name">
<strong><span style="font-family: Trebuchet MS, sans-serif;">Parthiv Patel</span></strong></div>
<div itemscope="" itemtype="http://schema.org/Organization">
<span itemprop="name" style="font-family: Trebuchet MS, sans-serif;">Bhaishri Info Solution</span></div>
<div itemprop="jobtitle">
<span style="font-family: Trebuchet MS, sans-serif;">Sr. PHP Developer</span></div>
<div itemprop="address" itemscope="" itemtype="http://schema.org/PostalAddress">
<div itemprop="streetAddress">
<span style="font-family: Trebuchet MS, sans-serif;">Limdi Chowk, AT PO. Nar, Di. Anand</span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;"><span itemprop="addressLocality">Nar</span>, <span itemprop="addressRegion">Gujarat</span></span></div>
<div itemprop="postalCode">
<span style="font-family: Trebuchet MS, sans-serif;">388150</span></div>
<div itemprop="addressCountry">
<span style="font-family: Trebuchet MS, sans-serif;">India</span></div>
</div>
<div itemprop="email">
<span style="font-family: Trebuchet MS, sans-serif;">pparthiv2412@gmail.com</span></div>
<div itemprop="telephone">
<span style="font-family: Trebuchet MS, sans-serif;">7383343029</span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;">DOB: 12/24/1986</span></div>
</div>
<br /></div>
Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-7280696971627524629.post-88653457011458159452013-06-02T21:47:00.005-07:002013-06-02T21:47:35.026-07:00PHP Constants and PHP Magic Constants<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="background-color: white; color: #333333; line-height: 18px; margin: 1em 0px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">PHP constants</span></h2>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">Variables offer a flexible way of storing data because you can change their values and the type of data they store at any time. If, however, you want to work with a value that you do not want to alter throughout your script’s execution, you can define a constant.</span></div>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">A constant is an identifier (name) for a simple value. As the name suggests, that value cannot change during the execution of the script (except for magic constants, which aren’t actually constants). A constant is case-sensitive by default. By convention, constant identifiers are always uppercase. The name of a constant follows the same rules as any label in PHP. A valid constant name starts with a letter or underscore, followed by any number of letters, numbers, or underscores.</span></div>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">You can define a constant by using the <strong>define()</strong> – function or by using the <strong>const</strong> keyword outside a class definition as of PHP 5.3.0. Once a constant is defined, it can never be changed or undefined.</span></div>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">To use the <strong>define()</strong> function, you must place the name of the constant and the value you want to give it within the call’s parentheses. These values must be separated by a comma, like so:</span></div>
<div style="background-color: white; color: #333333; line-height: 18px;">
<div class="syntaxhighlighter php" id="highlighter_720009" style="margin: 1em 0px !important; overflow-x: auto !important; overflow-y: hidden !important; position: relative !important; width: 618px;">
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 618px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">1</span></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">2</span></div>
<div class="line number3 index2 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">3</span></div>
<div class="line number4 index3 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">4</span></div>
<div class="line number5 index4 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">5</span></div>
<div class="line number6 index5 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">6</span></div>
<div class="line number7 index6 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">7</span></div>
<div class="line number8 index7 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">8</span></div>
<div class="line number9 index8 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">9</span></div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 590px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><span style="font-family: Trebuchet MS, sans-serif;"><?php</span></code></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number3 index2 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">define (</code><code class="php string" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"PI"</code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">, 3.14);</code></span></div>
<div class="line number4 index3 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">define (</code><code class="php string" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"CONSTANT"</code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">, </code><code class="php string" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"Hello World."</code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">);</code></span></div>
<div class="line number5 index4 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number6 index5 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php functions" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">print</code> <code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">PI.</code><code class="php string" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"<br>"</code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;</code></span></div>
<div class="line number7 index6 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php functions" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">print</code> <code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">CONSTANT;</code></span></div>
<div class="line number8 index7 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number9 index8 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><span style="font-family: Trebuchet MS, sans-serif;">?></span></code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">As of PHP 5, you can define constants within classes. You declare a constant using the <strong>const</strong> keyword at the top of your class. Constants are access by the class rather than an object as shown in below:</span></div>
<div style="background-color: white; color: #333333; line-height: 18px;">
<div class="syntaxhighlighter php" id="highlighter_969990" style="margin: 1em 0px !important; overflow-x: auto !important; overflow-y: hidden !important; position: relative !important; width: 618px;">
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 618px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">1</span></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">2</span></div>
<div class="line number3 index2 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">3</span></div>
<div class="line number4 index3 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">4</span></div>
<div class="line number5 index4 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">5</span></div>
<div class="line number6 index5 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">6</span></div>
<div class="line number7 index6 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">7</span></div>
<div class="line number8 index7 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">8</span></div>
<div class="line number9 index8 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">9</span></div>
<div class="line number10 index9 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">10</span></div>
<div class="line number11 index10 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">11</span></div>
<div class="line number12 index11 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">12</span></div>
<div class="line number13 index12 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">13</span></div>
<div class="line number14 index13 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">14</span></div>
<div class="line number15 index14 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">15</span></div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 583px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><span style="font-family: Trebuchet MS, sans-serif;"><?php</span></code></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number3 index2 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php keyword" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">class</code> <code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">testClass {</code></span></div>
<div class="line number4 index3 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php spaces" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code> </span></div>
<div class="line number5 index4 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php spaces" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="php keyword" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">const</code> <code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">PI = 3.14;</code></span></div>
<div class="line number6 index5 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php spaces" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="php keyword" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">const</code> <code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">CONSTANT = </code><code class="php string" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">'Hello World.'</code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;</code></span></div>
<div class="line number7 index6 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php spaces" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code> </span></div>
<div class="line number8 index7 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php spaces" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="php keyword" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">function</code> <code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">testFunc() {</code></span></div>
<div class="line number9 index8 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php spaces" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="php comments" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 130, 0) !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">// some codes</code></span></div>
<div class="line number10 index9 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php spaces" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></span></div>
<div class="line number11 index10 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><span style="font-family: Trebuchet MS, sans-serif;">}</span></code></div>
<div class="line number12 index11 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php functions" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">print</code> <code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">testClass::PI.</code><code class="php string" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"<br>"</code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;</code></span></div>
<div class="line number13 index12 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php functions" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">print</code> <code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">testClass::CONSTANT;</code></span></div>
<div class="line number14 index13 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number15 index14 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><span style="font-family: Trebuchet MS, sans-serif;">?></span></code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">You will get the same output for the above two php scripts as shown in below:<br />
<code style="background-color: #eaeaea; margin: 1px 0px; padding: 1px 3px;">3.14<br />
Hello World.</code></span></div>
<h2 style="background-color: white; color: #333333; line-height: 18px; margin: 1em 0px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">PHP Magic Constants</span></h2>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">PHP provides a large number of predefined constants to any script which it runs. Many of these constants, however, are created by various extensions, and will only be present when those extensions are available, either via dynamic loading or because they have been compiled in.</span></div>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">There are eight magical constants that change depending on where they are used. For example, the value of __LINE__ depends on the line that it’s used on in your script.</span></div>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">Magic constants include: __LINE__, __FILE__, __DIR__, __FUNCTION__, __CLASS__, and __METHOD__. These special constants are case-insensitive. Magic constants mostly used for debugging purpose.</span></div>
<h5 style="background-color: white; color: #333333; line-height: 18px; margin: 1em 0px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">1. __LINE__</span></h5>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">__LINE__ is the current line number of the file that is being parsed. This can be useful for debugging purposes. With this you can easily get details about the line numbers in files.</span></div>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">Note that if the file __LINE__ is used in is an include file, then the value of __LINE__ is the line number of the include file, not the script that includes the file.</span></div>
<h5 style="background-color: white; color: #333333; line-height: 18px; margin: 1em 0px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">2. __FILE__</span></h5>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">Display the full path and filename of the file. If used inside an include, the name of the included file is returned. __FILE__ always contains an absolute path with symlinks resolved whereas in older versions it contained relative path under some circumstances.</span></div>
<h5 style="background-color: white; color: #333333; line-height: 18px; margin: 1em 0px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">3. __DIR__</span></h5>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">The directory of the file. If used inside an include, the directory of the included file is returned. This is equivalent to dirname(__FILE__). This directory name does not have a trailing slash unless it is the root directory.</span></div>
<h5 style="background-color: white; color: #333333; line-height: 18px; margin: 1em 0px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">4. __FUNCTION__</span></h5>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">The function name. As of PHP 5 this constant returns the function name as it was declared (case-sensitive). In PHP 4 its value is always lowercased.</span></div>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">Check the first four magic constants with the below example. Notice that the parsing file used below is named index.php which is located on folder named ‘test’ inside WWW directory of the WAMP server.</span></div>
<div style="background-color: white; color: #333333; line-height: 18px;">
<div class="syntaxhighlighter php" id="highlighter_586008" style="margin: 1em 0px !important; overflow-x: auto !important; overflow-y: hidden !important; position: relative !important; width: 618px;">
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 618px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">1</span></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">2</span></div>
<div class="line number3 index2 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">3</span></div>
<div class="line number4 index3 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">4</span></div>
<div class="line number5 index4 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">5</span></div>
<div class="line number6 index5 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">6</span></div>
<div class="line number7 index6 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">7</span></div>
<div class="line number8 index7 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">8</span></div>
<div class="line number9 index8 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">9</span></div>
<div class="line number10 index9 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">10</span></div>
<div class="line number11 index10 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">11</span></div>
<div class="line number12 index11 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">12</span></div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 583px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><span style="font-family: Trebuchet MS, sans-serif;"><?php</span></code></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php spaces" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code> </span></div>
<div class="line number3 index2 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php keyword" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">function</code> <code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">testFunction() {</code></span></div>
<div class="line number4 index3 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php spaces" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="php functions" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">echo</code> <code class="php constants" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 204) !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">__LINE__</code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">.</code><code class="php string" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"<br>"</code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;</code></span></div>
<div class="line number5 index4 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php spaces" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="php functions" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">echo</code> <code class="php constants" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 204) !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">__FILE__</code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">.</code><code class="php string" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"<br>"</code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;</code></span></div>
<div class="line number6 index5 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php spaces" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="php functions" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">echo</code> <code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">dirname(</code><code class="php constants" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 204) !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">__FILE__</code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">).</code><code class="php string" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"<br>"</code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;</code></span></div>
<div class="line number7 index6 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php spaces" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="php functions" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">echo</code> <code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">__DIR__.</code><code class="php string" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"<br>"</code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;</code></span></div>
<div class="line number8 index7 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php spaces" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="php functions" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">echo</code> <code class="php constants" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 204) !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">__FUNCTION__</code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">.</code><code class="php string" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"<br>"</code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;</code></span></div>
<div class="line number9 index8 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><span style="font-family: Trebuchet MS, sans-serif;">}</span></code></div>
<div class="line number10 index9 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><span style="font-family: Trebuchet MS, sans-serif;">testFunction();</span></code></div>
<div class="line number11 index10 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number12 index11 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><span style="font-family: Trebuchet MS, sans-serif;">?></span></code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">The output of the above php script is,</span></div>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<code style="background-color: #eaeaea; margin: 1px 0px; padding: 1px 3px;"><span style="font-family: Trebuchet MS, sans-serif;">4<br />
C:\wamp\www\test\index.php<br />
C:\wamp\www\test<br />
C:\wamp\www\test<br />
testFunction</span></code></div>
<h5 style="background-color: white; color: #333333; line-height: 18px; margin: 1em 0px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">5. __CLASS__</span></h5>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">The class name. This is one of the interesting Magic constant because it returns class name as a result. As of PHP 5 this constant returns the class name as it was declared (case-sensitive). In PHP 4 its value is always lowercased. The class name includes the namespace it was declared in (e.g. Foo\Bar). Note that as of PHP 5.4 __CLASS__ works also in traits. When used in a trait method, __CLASS__ is the name of the class the trait is used in.</span></div>
<h5 style="background-color: white; color: #333333; line-height: 18px; margin: 1em 0px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">6. __METHOD__</span></h5>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">The class method name. Display the method name of class. One of the powerful Magic constant because of the method name is returned as it was declared (case-sensitive).</span></div>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">Check the __CLASS__ and __METHOD__ magic constants with the below example.</span></div>
<div style="background-color: white; color: #333333; line-height: 18px;">
<div class="syntaxhighlighter php" id="highlighter_442879" style="margin: 1em 0px !important; overflow-x: auto !important; overflow-y: hidden !important; position: relative !important; width: 618px;">
<table border="0" cellpadding="0" cellspacing="0" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-collapse: collapse; border-spacing: 0px; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 618px;"><tbody style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<tr style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><td class="gutter" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(175, 175, 175) !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">1</span></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">2</span></div>
<div class="line number3 index2 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">3</span></div>
<div class="line number4 index3 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">4</span></div>
<div class="line number5 index4 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">5</span></div>
<div class="line number6 index5 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">6</span></div>
<div class="line number7 index6 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">7</span></div>
<div class="line number8 index7 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">8</span></div>
<div class="line number9 index8 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">9</span></div>
<div class="line number10 index9 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">10</span></div>
<div class="line number11 index10 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">11</span></div>
<div class="line number12 index11 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-right-color: rgb(108, 226, 108) !important; border-right-style: solid !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border-width: 0px 3px 0px 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 0.5em 0px 1em !important; position: static !important; right: auto !important; text-align: right !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;">12</span></div>
</td><td class="code" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 583px;"><div class="container" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">
<div class="line number1 index0 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><span style="font-family: Trebuchet MS, sans-serif;"><?php</span></code></div>
<div class="line number2 index1 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number3 index2 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php keyword" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">class</code> <code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">testClass {</code></span></div>
<div class="line number4 index3 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php spaces" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="php keyword" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">function</code> <code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">testFunction() {</code></span></div>
<div class="line number5 index4 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php spaces" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="php functions" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">print</code> <code class="php constants" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 204) !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">__CLASS__</code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">.</code><code class="php string" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"<br>"</code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;</code></span></div>
<div class="line number6 index5 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php spaces" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="php functions" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(255, 20, 147) !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">print</code> <code class="php constants" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 204) !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">__METHOD__</code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">.</code><code class="php string" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: blue !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">"<br>"</code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">;</code></span></div>
<div class="line number7 index6 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php spaces" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: #333333; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"> </code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">}</code></span></div>
<div class="line number8 index7 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><span style="font-family: Trebuchet MS, sans-serif;">}</span></code></div>
<div class="line number9 index8 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php variable" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(170, 119, 0) !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">$testobj</code> <code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">= </code><code class="php keyword" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(0, 102, 153) !important; direction: ltr !important; display: inline !important; float: none !important; font-weight: bold !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">new</code> <code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">testClass();</code></span></div>
<div class="line number10 index9 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<span style="font-family: Trebuchet MS, sans-serif;"><code class="php variable" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; color: rgb(170, 119, 0) !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">$testobj</code><code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;">->testFunction();</code></span></div>
<div class="line number11 index10 alt2" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
</div>
<div class="line number12 index11 alt1" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px 1em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; white-space: pre !important; width: auto !important;">
<code class="php plain" style="background-image: none !important; border-bottom-left-radius: 0px !important; border-bottom-right-radius: 0px !important; border-top-left-radius: 0px !important; border-top-right-radius: 0px !important; border: 0px !important; bottom: auto !important; box-sizing: content-box !important; direction: ltr !important; display: inline !important; float: none !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; overflow: visible !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;"><span style="font-family: Trebuchet MS, sans-serif;">?></span></code></div>
</div>
</td></tr>
</tbody></table>
</div>
</div>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">The output of the above php code returns the class and method names as shown below,</span></div>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<code style="background-color: #eaeaea; margin: 1px 0px; padding: 1px 3px;"><span style="font-family: Trebuchet MS, sans-serif;">testClass<br />
testClass::testFunction</span></code></div>
<h5 style="background-color: white; color: #333333; line-height: 18px; margin: 1em 0px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">7. __TRAIT__</span></h5>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">The trait name. As of PHP 5.4 this constant returns the trait as it was declared (case-sensitive). The trait name includes the namespace it was declared in (e.g. Foo\Bar).</span></div>
<h5 style="background-color: white; color: #333333; line-height: 18px; margin: 1em 0px;">
<span style="font-family: Trebuchet MS, sans-serif; font-size: small;">8. __NAMESPACE__</span></h5>
<div style="background-color: white; color: #333333; line-height: 18px; margin-bottom: 1.25em; padding: 0px;">
<span style="font-family: Trebuchet MS, sans-serif;">The name of the current namespace (case-sensitive). This constant is defined in compile-time.</span></div>
<a href="https://plus.google.com/u/0/106212648989926698410?rel=author"><span style="font-family: Trebuchet MS, sans-serif;">-By Parthiv Patel</span></a><br />
<div itemscope="" itemtype="http://schema.org/Person">
<div itemprop="name">
<strong><span style="font-family: Trebuchet MS, sans-serif;">Parthiv Patel</span></strong></div>
<div itemscope="" itemtype="http://schema.org/Organization">
<span itemprop="name" style="font-family: Trebuchet MS, sans-serif;">Bhaishri Info Solution</span></div>
<div itemprop="jobtitle">
<span style="font-family: Trebuchet MS, sans-serif;">Sr. PHP Developer</span></div>
<div itemprop="address" itemscope="" itemtype="http://schema.org/PostalAddress">
<div itemprop="streetAddress">
<span style="font-family: Trebuchet MS, sans-serif;">Limdi Chowk, AT PO. Nar, Di. Anand</span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;"><span itemprop="addressLocality">Nar</span>, <span itemprop="addressRegion">Gujarat</span></span></div>
<div itemprop="postalCode">
<span style="font-family: Trebuchet MS, sans-serif;">388150</span></div>
<div itemprop="addressCountry">
<span style="font-family: Trebuchet MS, sans-serif;">India</span></div>
</div>
<div itemprop="email">
<span style="font-family: Trebuchet MS, sans-serif;">pparthiv2412@gmail.com</span></div>
<div itemprop="telephone">
<span style="font-family: Trebuchet MS, sans-serif;">7383343029</span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;">DOB: 12/24/1986</span></div>
</div>
</div>
Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-7280696971627524629.post-91839441509203883222013-06-02T21:39:00.003-07:002013-06-02T21:39:42.632-07:00Validating Credit Card Function<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: white; color: #1e1e20; font-family: Trebuchet MS, sans-serif; line-height: 18px;">This little function helps validating a given credit card number is legit:</span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><span style="background-color: white; color: #1e1e20; line-height: 18px;"><br />
</span> <span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">function </span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">ValidateCreditCardNumber</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">(</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$cc_num</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">)<br />
{<br />
</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$pattern </span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">= </span><span style="background-color: #fdf8eb; color: #cc0000; line-height: 18px;">"/^3[47]\d{13}$/"</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">;</span><span style="background-color: #fdf8eb; color: #ff9900; line-height: 18px;">//American Express<br />
</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">if (</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">preg_match</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">(</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$pattern</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">,</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$cc_num</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">))<br />
{<br />
return </span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">true</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">;<br />
}<br />
<br />
</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$pattern </span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">= </span><span style="background-color: #fdf8eb; color: #cc0000; line-height: 18px;">"/^([30|36|38]{2})([0-9]{12})$/"</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">;</span><span style="background-color: #fdf8eb; color: #ff9900; line-height: 18px;">//Diner's Club<br />
</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">if (</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">preg_match</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">(</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$pattern</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">,</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$cc_num</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">))<br />
{<br />
return </span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">true</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">;<br />
}<br />
<br />
</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$pattern </span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">= </span><span style="background-color: #fdf8eb; color: #cc0000; line-height: 18px;">"/^6011\d{12}$/"</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">;</span><span style="background-color: #fdf8eb; color: #ff9900; line-height: 18px;">//Discover Card<br />
</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">if (</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">preg_match</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">(</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$pattern</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">,</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$cc_num</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">))<br />
{<br />
return </span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">true</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">;<br />
}<br />
<br />
</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$pattern </span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">= </span><span style="background-color: #fdf8eb; color: #cc0000; line-height: 18px;">"/^5[12345]\d{14}$/"</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">;</span><span style="background-color: #fdf8eb; color: #ff9900; line-height: 18px;">//Mastercard<br />
</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">if (</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">preg_match</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">(</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$pattern</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">,</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$cc_num</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">))<br />
{<br />
return </span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">true</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">;<br />
}<br />
<br />
</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$pattern </span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">= </span><span style="background-color: #fdf8eb; color: #cc0000; line-height: 18px;">"/^4\d{12}(\d\d\d){0,1}$/"</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">;</span><span style="background-color: #fdf8eb; color: #ff9900; line-height: 18px;">//Visa<br />
</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">if (</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">preg_match</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">(</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$pattern</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">,</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$cc_num</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">))<br />
{<br />
return </span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">true</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">;<br />
}<br />
<br />
</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$pattern </span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">= </span><span style="background-color: #fdf8eb; color: #cc0000; line-height: 18px;">"/^30[012345]\d{11}$/"</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">;</span><span style="background-color: #fdf8eb; color: #ff9900; line-height: 18px;">//Diners<br />
</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">if (</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">preg_match</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">(</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$pattern</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">,</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$cc_num</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">))<br />
{<br />
return </span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">true</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">;<br />
}<br />
<br />
</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$pattern </span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">= </span><span style="background-color: #fdf8eb; color: #cc0000; line-height: 18px;">"/^3[68]\d{12}$/"</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">;</span><span style="background-color: #fdf8eb; color: #ff9900; line-height: 18px;">//Diners #2<br />
</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">if (</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">preg_match</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">(</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$pattern</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">,</span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">$cc_num</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">))<br />
{<br />
return </span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">true</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">;<br />
}<br />
<br />
</span><span style="background-color: #fdf8eb; color: #ff9900; line-height: 18px;">// Not valid<br />
</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">return </span><span style="background-color: #fdf8eb; color: #0000cc; line-height: 18px;">false</span><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;">;<br />
}</span></span><br />
<span style="font-family: Trebuchet MS, sans-serif;"><span style="background-color: #fdf8eb; color: #006600; line-height: 18px;"><br />
</span> <span style="background-color: #fdf8eb; color: #006600; line-height: 18px;"><br />
</span></span><br />
<a href="https://plus.google.com/u/0/106212648989926698410?rel=author"><span style="font-family: Trebuchet MS, sans-serif;">-By Parthiv Patel</span></a><br />
<div itemscope="" itemtype="http://schema.org/Person">
<div itemprop="name">
<strong><span style="font-family: Trebuchet MS, sans-serif;">Parthiv Patel</span></strong></div>
<div itemscope="" itemtype="http://schema.org/Organization">
<span itemprop="name" style="font-family: Trebuchet MS, sans-serif;">Bhaishri Info Solution</span></div>
<div itemprop="jobtitle">
<span style="font-family: Trebuchet MS, sans-serif;">Sr. PHP Developer</span></div>
<div itemprop="address" itemscope="" itemtype="http://schema.org/PostalAddress">
<div itemprop="streetAddress">
<span style="font-family: Trebuchet MS, sans-serif;">Limdi Chowk, AT PO. Nar, Di. Anand</span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;"><span itemprop="addressLocality">Nar</span>, <span itemprop="addressRegion">Gujarat</span></span></div>
<div itemprop="postalCode">
<span style="font-family: Trebuchet MS, sans-serif;">388150</span></div>
<div itemprop="addressCountry">
<span style="font-family: Trebuchet MS, sans-serif;">India</span></div>
</div>
<div itemprop="email">
<span style="font-family: Trebuchet MS, sans-serif;">pparthiv2412@gmail.com</span></div>
<div itemprop="telephone">
<span style="font-family: Trebuchet MS, sans-serif;">7383343029</span></div>
<div>
<span style="font-family: Trebuchet MS, sans-serif;">DOB: 12/24/1986</span></div>
</div>
</div>
Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-7280696971627524629.post-4897791918218824682013-05-31T12:19:00.000-07:002013-06-10T05:27:14.516-07:00Fridaygram: supporting nonprofits, yawning dogs, Easter egg in space<table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody><tr><td style="text-align: center;"><img height="80" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaWJmjMXvUvPSGTBbROFeNCUjSmotZniJ31TcBZpA7Hjh0EyAIDmjBE06QSVFw0A73MIo2QWQz_19xVGWMSA9tp7KRqB9Yx56a7obVMldKFy_dmp32YUrU48PQK-2xLidcBN5sMcocDZY/s1600/scottk.jpg" style="margin-left: auto; margin-right: auto; text-align: right;" /></td></tr><tr><td class="tr-caption" style="text-align: center;">Scott</td></tr></tbody></table><table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody><tr><td style="text-align: center;"><img height="80" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgn8_q38f9yut11erNiM66Xr6rDZZFVFXVzH1S0FAMZ9O-KdK7yE7NdC44mcRzfHxADMGO7sN4no2nCgixUvhuqANMFyyErSgqP4R7NuIqx1Y8BxdUz-zW-l-W-eXR3rf3v3jlnaZRjkw/s1600/maya_photo.png" style="margin-left: auto; margin-right: auto; text-align: right;" /></td></tr><tr><td class="tr-caption" style="text-align: center;">Maya</td></tr></tbody></table><em>By Maya Amoils, Google.org, and Scott Knaster, Developer Relations</em><br /><br />Throughout this month, we’ve asked developers around the world to sign up for <a href="http://www.mindfulinmay.org/">Be Mindful in May</a>, a one-month meditation campaign that challenges participants to learn about meditation while simultaneously dedicating their efforts to a global cause: providing clean water to people in developing nations. So far the campaign has raised over $75,000 AUD for this important issue, and the <a href="https://www.mycause.com.au/page/googledevelopers">Google Developers team</a> has raised $1700 AUD. <br /><br />The money raised through Be Mindful in May will go to <a href="http://www.charitywater.org/">charity:water</a>, an organization that’s helping to bring clean, safe drinking water to the nearly 1 billion people who struggle every day without it.<br /><br /><div class="separator" style="text-align: center;"><br /><a href="http://www.google.com/onetoday/"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1Tzq7N29FGFONQkRFTv-MQRoA5kq5p4p3ZWSZS_1kJkddZtjm2QojUsjVQrKqlrYXDiTU-FkaCzWy7wnEvnUBi0G_LCQD1OiWI5gPhJXMIExNLuP3W5i2TobbwmP8amEen3End7EtiR4/s1600/water-changes-everything_phone.jpg" alt="" style="border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; text-align: center;" width="214" /></a></div><br />To help support nonprofits like charity:water, last month we released the <a href="http://www.google.com/onetoday/">One Today</a> mobile app as a limited pilot in the US. One Today introduces users to new projects each day across a wide range of issues, and enables users to donate $1 to the cause. One Today users can amplify their impact by matching their friends’ donations. If you’re in the US, you can join the One Today pilot by <a href="http://www.google.com/onetoday/">requesting an invite</a>.<br /><br />From making a difference in the world to wacky science, studies suggest that <a href="http://blogs.scientificamerican.com/not-bad-science/2013/05/28/why-do-dogs-yawn-when-they-see-sleepy-humans/">dogs yawn in response to humans</a>. And not only that: further research shows that sometimes, dogs yawn in empathy with humans yawning, while other times, dogs yawn because they’re feeling stress, as when they’re listening to their owners. Much more research involving yawning dogs and people will be necessary to fully sort this out.<br /><br />Finally, if you’re previewing the <a href="http://google-latlong.blogspot.com/2013/05/meet-new-google-maps-map-for-every.html">new Google Maps</a>, you might be interested in <a href="https://plus.google.com/105417976649853791222/posts/NP2g8wZvmBc">this cool Easter egg</a>. And if you’re <i>not</i> on the new Google Maps, you can <a href="http://maps.google.com/help/maps/helloworld/desktop/preview/">request an invite</a>. It’s really nice, and might even keep you from yawning.<br /><br /><br /><em><a href="http://googledevelopers.blogspot.com/search/label/Fridaygram">Fridaygrams</a> provide a chance for us to focus on fun and interesting stuff that’s not necessarily related to writing code. Sometimes we even get to feature inspiring content, like this week’s information about helping nonprofits.<br /><br />Maya Amoils is a member of the Google.org marketing team where she works on a number of the team's charitable giving initiatives. Maya holds a BA in Science Technology & Society from Stanford University. Outside of work, you can find her biking around the Bay Area or making playlists on Spotify.<br /><br /><a href="http://google.com/+ScottKnaster">Scott Knaster</a> is the editor of <a href="http://googledevelopers.blogspot.com">Google Developers Blog</a>. He likes family time, technology, and watching the San Francisco Giants win baseball games.</em><br /><blockquote></blockquote>Anonymousnoreply@blogger.com0Mountain View, CA, USA37.3860517 -122.083851137.2851427 -122.2452126 37.486960700000004 -121.9224896tag:blogger.com,1999:blog-7280696971627524629.post-2058357948882596162013-05-29T22:51:00.001-07:002013-05-29T23:31:43.683-07:00jQuery - Chaining<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="intro" style="color: #404040; line-height: 20px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">With jQuery, you can chain together actions/methods.</span></div>
<div class="intro" style="color: #404040; line-height: 20px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Chaining allows us to run multiple jQuery methods (on the same element) within a single statement.</span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery Method Chaining</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Until now we have been writing jQuery statements one at a time (one after the other).</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">However, there is a technique called chaining, that allows us to run multiple jQuery commands, one after the other, on the same element(s).</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><b>Tip:</b> This way, browsers do not have to find the same element(s) more than once.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">To chain an action, you simply append the action to the previous action.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The following example chains together the css(), slideUp(), and slideDown() methods. The "p1" element first changes to red, then it slides up, and then it slides down:</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; text-align: justify; width: 696.7613525390625px;">
<span style="font-family: Verdana, sans-serif;">$("#p1").css("color","red").slideUp(2000).slideDown(2000);</span></div>
<span style="font-family: Verdana, sans-serif;"></span><br />
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<span style="font-family: Verdana, sans-serif;">
</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">We could also have added more method calls if needed.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><b>Tip</b>: When chaining, the line of code could become quite long. However, jQuery is not very strict on the syntax; you can format it like you want, including line breaks and indentations.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">This also works just fine:</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("#p1").css("color","red")</span></div>
<span style="font-family: Verdana, sans-serif;"></span><br />
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"> .slideUp(2000)</span></div>
<span style="font-family: Verdana, sans-serif;">
</span>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"> .slideDown(2000);</span></div>
<span style="font-family: Verdana, sans-serif;">
</span></div>
<span style="font-family: Verdana, sans-serif;"></span><br />
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<span style="font-family: Verdana, sans-serif;">
</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">jQuery throws away extra whitespace and executes the lines above as one long line of code.</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="chapter" style="height: 20px; margin: 0px; padding: 0px; width: 722.9971313476563px;">
<div class="prev" style="float: left; text-align: justify; width: 289.1903381347656px;">
<a href="https://plus.google.com/u/0/106212648989926698410?rel=author" style="background-color: white; border: 0px; color: #1d92a3; line-height: 21px; margin: 0px; outline: none; padding: 0px; text-decoration: none; vertical-align: baseline;"><span style="font-family: Verdana, sans-serif;">-By Parthiv Patel</span></a></div>
</div>
</div>
<div itemscope itemtype="http://schema.org/Person">
<div itemprop="name"><strong>Parthiv Patel</strong></div>
<div itemscope itemtype="http://schema.org/Organization"><span itemprop="name">Bhaishri Info Solution</span></div><div itemprop="jobtitle">Sr. PHP Developer</div>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<div itemprop="streetAddress">Limdi Chowk, AT PO. Nar, Di. Anand</div>
<div><span itemprop="addressLocality">Nar</span>, <span itemprop="addressRegion">Gujarat</span></div><div itemprop="postalCode">388150</div>
<div itemprop="addressCountry">India</div>
</div>
<div itemprop="email">pparthiv2412@gmail.com</div>
<div itemprop="telephone">7383343029</div>
<div><meta itemprop="birthDate" content="1986-12-24">DOB: 12/24/1986</div>
</div>
Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-7280696971627524629.post-86394359708957601012013-05-29T22:48:00.001-07:002013-05-29T23:32:04.443-07:00jQuery Callback Functions<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="intro" style="color: #404040; line-height: 20px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">A callback function is executed after the current effect is 100% finished.</span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery Callback Functions</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">JavaScript statements are executed line by line. However, with effects, the next line of code can be run even though the effect is not finished. This can create errors.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">To prevent this, you can create a callback function.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">A callback function is executed after the current effect is finished.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Typical syntax: <b>$(<i>selector</i>).hide(<i>speed,callback</i>);</b></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;"><br /></span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">Examples</span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The example below has a callback parameter that is a function that will be executed after the hide effect is completed:</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example with Callback</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("button").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$("p").hide("slow",function(){</div>
<div style="text-align: justify;">
alert("The paragraph is now hidden");</div>
<div style="text-align: justify;">
});</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">T<span style="line-height: 16.363636016845703px;">he example below has no callback parameter, and the alert box will be displayed before the hide effect is completed:</span></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="line-height: 16.363636016845703px;"><span style="font-family: Verdana, sans-serif;"><br /></span></span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example without Callback</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("button").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$("p").hide(1000);</div>
<div style="text-align: justify;">
alert("The paragraph is now hidden");</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<br />
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
<div style="background-color: white; border: 0px; color: #1d92a3; line-height: 21px; margin: 0px; outline: none; padding: 0px; text-align: justify; text-decoration: none; vertical-align: baseline;">
<a href="https://plus.google.com/u/0/106212648989926698410?rel=author" style="background-color: white; border: 0px; color: #1d92a3; line-height: 21px; margin: 0px; outline: none; padding: 0px; text-decoration: none; vertical-align: baseline;"></a><a href="https://plus.google.com/u/0/106212648989926698410?rel=author" style="border: 0px; color: #1d92a3; margin: 0px; outline: none; padding: 0px; text-decoration: none; vertical-align: baseline;">-By Parthiv Patel</a></div>
</span></div>
<div itemscope itemtype="http://schema.org/Person">
<div itemprop="name"><strong>Parthiv Patel</strong></div>
<div itemscope itemtype="http://schema.org/Organization"><span itemprop="name">Bhaishri Info Solution</span></div><div itemprop="jobtitle">Sr. PHP Developer</div>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<div itemprop="streetAddress">Limdi Chowk, AT PO. Nar, Di. Anand</div>
<div><span itemprop="addressLocality">Nar</span>, <span itemprop="addressRegion">Gujarat</span></div><div itemprop="postalCode">388150</div>
<div itemprop="addressCountry">India</div>
</div>
<div itemprop="email">pparthiv2412@gmail.com</div>
<div itemprop="telephone">7383343029</div>
<div><meta itemprop="birthDate" content="1986-12-24">DOB: 12/24/1986</div>
</div>
Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-7280696971627524629.post-1053077547109188222013-05-29T22:46:00.001-07:002013-05-29T23:32:17.503-07:00jQuery Stop Animations<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="intro" style="color: #404040; line-height: 20px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The jQuery stop() method is used to stop animations or effects before it is finished.</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Examples</span></h2>
<div style="line-height: 16.363636016845703px;">
</div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; line-height: 16.363636016845703px;">jQuery stop() sliding</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<span style="line-height: 16.363636016845703px;">Demonstrates the jQuery stop() method.</span></div>
</span><br />
<div style="line-height: 16.363636016845703px;">
</div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; line-height: 16.363636016845703px;">jQuery stop() animation (with parameters)</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<span style="line-height: 16.363636016845703px;">Demonstrates the jQuery stop() method.</span></div>
</span><br />
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery stop() Method</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The jQuery stop() method is used to stop an animation or effect before it is finished.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The stop() method works for all jQuery effect functions, including sliding, fading and custom animations.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">Syntax:</span></b></div>
<div class="code notranslate" style="background-color: #f6f4f0; border: 1px solid rgb(212, 212, 212); color: #444444; margin: 0px; padding: 5px; width: 711px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$(<i>selector</i>).stop(<i>stopAll,goToEnd</i>);</span></div>
</div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional stopAll parameter specifies whether also the animation queue should be cleared or not. Default is false, which means that only the active animation will be stopped, allowing any queued animations to be performed afterwards.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional goToEnd parameter specifies whether or not to complete the current animation immediately. Default is false.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">So, by default, the stop() method kills the current animation being performed on the selected element.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The following example demonstrates the stop() method, with no parameters:</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("#stop").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$("#panel").stop();</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<a href="https://plus.google.com/u/0/106212648989926698410?rel=author" style="background-color: white; border: 0px; color: #1d92a3; line-height: 21px; margin: 0px; outline: none; padding: 0px; text-decoration: none; vertical-align: baseline;"><span style="font-family: Verdana, sans-serif; font-size: small;">-By Parthiv Patel</span></a></h2>
</div>
<div itemscope itemtype="http://schema.org/Person">
<div itemprop="name"><strong>Parthiv Patel</strong></div>
<div itemscope itemtype="http://schema.org/Organization"><span itemprop="name">Bhaishri Info Solution</span></div><div itemprop="jobtitle">Sr. PHP Developer</div>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<div itemprop="streetAddress">Limdi Chowk, AT PO. Nar, Di. Anand</div>
<div><span itemprop="addressLocality">Nar</span>, <span itemprop="addressRegion">Gujarat</span></div><div itemprop="postalCode">388150</div>
<div itemprop="addressCountry">India</div>
</div>
<div itemprop="email">pparthiv2412@gmail.com</div>
<div itemprop="telephone">7383343029</div>
<div><meta itemprop="birthDate" content="1986-12-24">DOB: 12/24/1986</div>
</div>
Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-7280696971627524629.post-6733258005962639502013-05-29T22:43:00.001-07:002013-05-29T23:34:33.903-07:00jQuery Effects - Animation<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="intro" style="color: #404040; line-height: 20px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">he jQuery animate() method lets you create custom animations.</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">jQuery Animations - The animate() Method</span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The jQuery animate() method is used to create custom animations.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">Syntax:</span></b></div>
<div class="code notranslate" style="background-color: #f6f4f0; border: 1px solid rgb(212, 212, 212); color: #444444; margin: 0px; padding: 5px; width: 711px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$(<i>selector</i>).animate({<i>params</i>}<i>,speed,callback</i>);</span></div>
</div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The required params parameter defines the CSS properties to be animated.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional callback parameter is a function to be executed after the animation completes.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The following example demonstrates a simple use of the animate() method; it moves a <div> element to the left, until it has reached a left property of 250px:</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("button").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$("div").animate({left:'250px'});</div>
<div style="text-align: justify;">
}); </div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<table class="lamp" style="border: 1px solid rgb(212, 212, 212); color: black; padding: 0px; text-align: justify; width: 720.9090576171875px;"><tbody>
<tr><th style="background-color: white; padding: 10px 5px 10px 10px;" width="34"></th><td style="background-color: white; line-height: 16.363636016845703px; padding: 4px 10px 4px 0px;"><span style="font-family: Verdana, sans-serif;">By default, all HTML elements have a static position, and cannot be moved.<br />To manipulate the position, remember to first set the CSS position property of the element to relative, fixed, or absolute!</span></td></tr>
</tbody></table>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery animate() - Manipulate Multiple Properties</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Notice that multiple properties can be animated at the same time:</span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("button").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$("div").animate({</div>
<div style="text-align: justify;">
left:'250px',</div>
<div style="text-align: justify;">
opacity:'0.5',</div>
<div style="text-align: justify;">
height:'150px',</div>
<div style="text-align: justify;">
width:'150px'</div>
<div style="text-align: justify;">
});</div>
<div style="text-align: justify;">
}); </div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<table class="lamp" id="table1" style="border: 1px solid rgb(212, 212, 212); color: black; padding: 0px; text-align: justify; width: 720.9090576171875px;"><tbody>
<tr><th style="background-color: white; padding: 10px 5px 10px 10px;" width="34"></th><td style="background-color: white; line-height: 16.363636016845703px; padding: 4px 10px 4px 0px;"><span style="font-family: Verdana, sans-serif;"><b>Is it possible to manipulate ALL CSS properties with the animate() method?</b><br /><br />Yes, almost! However, there is one important thing to remember: all property names must be camel-cased when used with the animate() method: You will need to write paddingLeft instead of padding-left, marginRight instead of margin-right, and so on.<br /><br />Also, color animation is not included in the core jQuery library.<br />If you want to animate color, you need to download the <a href="http://plugins.jquery.com/project/color" style="background-color: transparent; color: black;" target="_blank">Color Animations plugin</a> from jQuery.com.</span></td></tr>
</tbody></table>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery animate() - Using Relative Values</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">It is also possible to define relative values (the value is then relative to the element's current value). This is done by putting += or -= in front of the value:</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("button").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$("div").animate({</div>
<div style="text-align: justify;">
left:'250px',</div>
<div style="text-align: justify;">
height:'+=150px',</div>
<div style="text-align: justify;">
width:'+=150px'</div>
<div style="text-align: justify;">
});</div>
<div style="text-align: justify;">
}); </div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery animate() - Using Pre-defined Values</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">You can even specify a property's animation value as "show", "hide", or "toggle":</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("button").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$("div").animate({</div>
<div style="text-align: justify;">
height:'toggle'</div>
<div style="text-align: justify;">
});</div>
<div style="text-align: justify;">
}); </div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery animate() - Uses Queue Functionality</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">By default, jQuery comes with queue functionality for animations.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">This means that if you write multiple animate() calls after each other, jQuery creates an "internal" queue with these method calls. Then it runs the animate calls ONE by ONE.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">So, if you want to perform different animations after each other, we take advantage of the queue functionality:</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example 1</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("button").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
var div=$("div");</div>
<div style="text-align: justify;">
div.animate({height:'300px',opacity:'0.4'},"slow");</div>
<div style="text-align: justify;">
div.animate({width:'300px',opacity:'0.8'},"slow");</div>
<div style="text-align: justify;">
div.animate({height:'100px',opacity:'0.4'},"slow");</div>
<div style="text-align: justify;">
div.animate({width:'100px',opacity:'0.8'},"slow");</div>
<div style="text-align: justify;">
}); </div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The example below first moves the <div> element to the right, and then increases the font size of the text:</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example 2</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("button").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
var div=$("div");</div>
<div style="text-align: justify;">
div.animate({left:'100px'},"slow");</div>
<div style="text-align: justify;">
div.animate({fontSize:'3em'},"slow");</div>
<div style="text-align: justify;">
}); </div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<a href="https://plus.google.com/u/0/106212648989926698410?rel=author" style="background-color: white; border: 0px; color: #1d92a3; line-height: 21px; margin: 0px; outline: none; padding: 0px; text-decoration: none; vertical-align: baseline;"><span style="font-family: Verdana, sans-serif; font-size: small;">-By Parthiv Patel</span></a></h2>
</div>
<div itemscope itemtype="http://schema.org/Person">
<div itemprop="name"><strong>Parthiv Patel</strong></div>
<div itemscope itemtype="http://schema.org/Organization"><span itemprop="name">Bhaishri Info Solution</span></div><div itemprop="jobtitle">Sr. PHP Developer</div>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<div itemprop="streetAddress">Limdi Chowk, AT PO. Nar, Di. Anand</div>
<div><span itemprop="addressLocality">Nar</span>, <span itemprop="addressRegion">Gujarat</span></div><div itemprop="postalCode">388150</div>
<div itemprop="addressCountry">India</div>
</div>
<div itemprop="email">pparthiv2412@gmail.com</div>
<div itemprop="telephone">7383343029</div>
<div><meta itemprop="birthDate" content="1986-12-24">DOB: 12/24/1986</div>
</div>
Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-7280696971627524629.post-75292121084566022672013-05-29T22:39:00.001-07:002013-05-29T23:34:53.919-07:00jQuery Effects - Sliding<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="intro" style="color: #404040; line-height: 20px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The jQuery slide methods slides elements up and down.</span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Examples</span></h2>
<div style="line-height: 16.363636016845703px;">
</div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; line-height: 16.363636016845703px;">jQuery slideDown()</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<span style="line-height: 16.363636016845703px;">Demonstrates the jQuery slideDown() method.</span></div>
</span><br />
<div style="line-height: 16.363636016845703px;">
</div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; line-height: 16.363636016845703px;">jQuery slideUp()</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<span style="line-height: 16.363636016845703px;">Demonstrates the jQuery slideUp() method.</span></div>
</span><br />
<div style="line-height: 16.363636016845703px;">
</div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; line-height: 16.363636016845703px;">jQuery slideToggle()</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<span style="line-height: 16.363636016845703px;">Demonstrates the jQuery SlideToggle() method.</span></div>
</span><br />
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery Sliding Methods</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">With jQuery you can create a sliding effect on elements.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">jQuery has the following slide methods:</span></div>
<ul style="line-height: 16.363636016845703px;">
<li style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">slideDown()</span></li>
<li style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">slideUp()</span></li>
<li style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">slideToggle()</span></li>
</ul>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery slideDown() Method</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The jQuery slideDown() method is used to slide down an element.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">Syntax:</span></b></div>
<div class="code notranslate" style="background-color: #f6f4f0; border: 1px solid rgb(212, 212, 212); color: #444444; margin: 0px; padding: 5px; width: 711px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$(<i>selector</i>).slideDown(<i>speed,callback</i>);</span></div>
</div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional callback parameter is a function to be executed after the sliding completes.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The following example demonstrates the slideDown() method:</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("#flip").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$("#panel").slideDown();</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery slideUp() Method</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The jQuery slideUp() method is used to slide up an element.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">Syntax:</span></b></div>
<div class="code notranslate" style="background-color: #f6f4f0; border: 1px solid rgb(212, 212, 212); color: #444444; margin: 0px; padding: 5px; width: 711px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$(<i>selector</i>).slideUp(<i>speed,callback</i>);</span></div>
</div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional callback parameter is a function to be executed after the sliding completes.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The following example demonstrates the slideUp() method:</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("#flip").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$("#panel").slideUp();</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery slideToggle() Method</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The jQuery slideToggle() method toggles between the slideDown() and slideUp() methods.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">If the elements have been slid down, slideToggle() will slide them up.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">If the elements have been slid up, slideToggle() will slide them down.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="code notranslate" style="background-color: #f6f4f0; border: 1px solid rgb(212, 212, 212); color: #444444; margin: 0px; padding: 5px; width: 711px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$(<i>selector</i>).slideToggle(<i>speed,callback</i>);</span></div>
</div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional speed parameter can take the following values: "slow", "fast", milliseconds.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional callback parameter is a function to be executed after the sliding completes.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The following example demonstrates the slideToggle() method:</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("#flip").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$("#panel").slideToggle();</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<a href="https://plus.google.com/u/0/106212648989926698410?rel=author" style="background-color: white; border: 0px; color: #1d92a3; line-height: 21px; margin: 0px; outline: none; padding: 0px; text-decoration: none; vertical-align: baseline;"><span style="font-family: Verdana, sans-serif;">-By Parthiv Patel</span></a></div>
</div>
<div itemscope itemtype="http://schema.org/Person">
<div itemprop="name"><strong>Parthiv Patel</strong></div>
<div itemscope itemtype="http://schema.org/Organization"><span itemprop="name">Bhaishri Info Solution</span></div><div itemprop="jobtitle">Sr. PHP Developer</div>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<div itemprop="streetAddress">Limdi Chowk, AT PO. Nar, Di. Anand</div>
<div><span itemprop="addressLocality">Nar</span>, <span itemprop="addressRegion">Gujarat</span></div><div itemprop="postalCode">388150</div>
<div itemprop="addressCountry">India</div>
</div>
<div itemprop="email">pparthiv2412@gmail.com</div>
<div itemprop="telephone">7383343029</div>
<div><meta itemprop="birthDate" content="1986-12-24">DOB: 12/24/1986</div>
</div>
Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-7280696971627524629.post-17344416542014195822013-05-29T22:18:00.001-07:002013-05-29T23:35:16.431-07:00jQuery Effects - Fading<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="intro" style="color: #404040; line-height: 20px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">With jQuery you can fade elements in and out of visibility.</span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Examples</span></h2>
<div style="line-height: 16.363636016845703px;">
</div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; line-height: 16.363636016845703px;">jQuery fadeIn()</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<span style="line-height: 16.363636016845703px;">Demonstrates the jQuery fadeIn() method.</span></div>
</span><br />
<div style="line-height: 16.363636016845703px;">
</div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; line-height: 16.363636016845703px;">jQuery fadeOut()</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<span style="line-height: 16.363636016845703px;">Demonstrates the jQuery fadeOut() method.</span></div>
</span><br />
<div style="line-height: 16.363636016845703px;">
</div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; line-height: 16.363636016845703px;">jQuery fadeToggle()</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<span style="line-height: 16.363636016845703px;">Demonstrates the jQuery fadeToggle() method.</span></div>
</span><br />
<div style="line-height: 16.363636016845703px;">
</div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; line-height: 16.363636016845703px;">jQuery fadeTo()</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<span style="line-height: 16.363636016845703px;">Demonstrates the jQuery fadeTo() method.</span></div>
</span><br />
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery Fading Methods</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">With jQuery you can fade an element in and out of visibility.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">jQuery has the following fade methods:</span></div>
<ul style="line-height: 16.363636016845703px;">
<li style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">fadeIn()</span></li>
<li style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">fadeOut()</span></li>
<li style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">fadeToggle()</span></li>
<li style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">fadeTo()</span></li>
</ul>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery fadeIn() Method</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The jQuery fadeIn() method is used to fade in a hidden element.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">Syntax:</span></b></div>
<div class="code notranslate" style="background-color: #f6f4f0; border: 1px solid rgb(212, 212, 212); color: #444444; margin: 0px; padding: 5px; width: 711px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$(<i>selector</i>).fadeIn(<i>speed,callback</i>);</span></div>
</div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<br /></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional callback parameter is a function to be executed after the fading completes.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The following example demonstrates the fadeIn() method with different parameters:</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("button").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$("#div1").fadeIn();</div>
<div style="text-align: justify;">
$("#div2").fadeIn("slow");</div>
<div style="text-align: justify;">
$("#div3").fadeIn(3000);</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery fadeOut() Method</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The jQuery fadeOut() method is used to fade out a visible element.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">Syntax:</span></b></div>
<div class="code notranslate" style="background-color: #f6f4f0; border: 1px solid rgb(212, 212, 212); color: #444444; margin: 0px; padding: 5px; width: 711px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$(<i>selector</i>).fadeOut(<i>speed,callback</i>);</span></div>
</div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional callback parameter is a function to be executed after the fading completes.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The following example demonstrates the fadeOut() method with different parameters:</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("button").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$("#div1").fadeOut();</div>
<div style="text-align: justify;">
$("#div2").fadeOut("slow");</div>
<div style="text-align: justify;">
$("#div3").fadeOut(3000);</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery fadeToggle() Method</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The jQuery fadeToggle() method toggles between the fadeIn() and fadeOut() methods.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">If the elements are faded out, fadeToggle() will fade them in.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">If the elements are faded in, fadeToggle() will fade them out.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">Syntax:</span></b></div>
<div class="code notranslate" style="background-color: #f6f4f0; border: 1px solid rgb(212, 212, 212); color: #444444; margin: 0px; padding: 5px; width: 711px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$(<i>selector</i>).fadeToggle(<i>speed,callback</i>);</span></div>
</div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional callback parameter is a function to be executed after the fading completes.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The following example demonstrates the fadeToggle() method with different parameters:</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("button").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$("#div1").fadeToggle();</div>
<div style="text-align: justify;">
$("#div2").fadeToggle("slow");</div>
<div style="text-align: justify;">
$("#div3").fadeToggle(3000);</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery fadeTo() Method</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The jQuery fadeTo() method allows fading to a given opacity (value between 0 and 1).</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">Syntax:</span></b></div>
<div class="code notranslate" style="background-color: #f6f4f0; border: 1px solid rgb(212, 212, 212); color: #444444; margin: 0px; padding: 5px; width: 711px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$(<i>selector</i>).fadeTo(<i>speed,opacity,callback</i>);</span></div>
</div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The required speed parameter specifies the duration of the effect. It can take the following values: "slow", "fast", or milliseconds.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The required opacity parameter in the fadeTo() method specifies fading to a given opacity (value between 0 and 1).</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional callback parameter is a function to be executed after the function completes.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The following example demonstrates the fadeTo() method with different parameters:</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("button").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$("#div1").fadeTo("slow",0.15);</div>
<div style="text-align: justify;">
$("#div2").fadeTo("slow",0.4);</div>
<div style="text-align: justify;">
$("#div3").fadeTo("slow",0.7);</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="background-color: white; border: 0px; color: #1d92a3; line-height: 21px; margin: 0px; outline: none; padding: 0px; text-align: justify; text-decoration: none; vertical-align: baseline;">
<a href="https://plus.google.com/u/0/106212648989926698410?rel=author" style="border: 0px; color: #1d92a3; margin: 0px; outline: none; padding: 0px; text-decoration: none; vertical-align: baseline;"><span style="font-family: Verdana, sans-serif;">-By Parthiv Patel</span></a></div>
</div>
<div itemscope itemtype="http://schema.org/Person">
<div itemprop="name"><strong>Parthiv Patel</strong></div>
<div itemscope itemtype="http://schema.org/Organization"><span itemprop="name">Bhaishri Info Solution</span></div><div itemprop="jobtitle">Sr. PHP Developer</div>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<div itemprop="streetAddress">Limdi Chowk, AT PO. Nar, Di. Anand</div>
<div><span itemprop="addressLocality">Nar</span>, <span itemprop="addressRegion">Gujarat</span></div><div itemprop="postalCode">388150</div>
<div itemprop="addressCountry">India</div>
</div>
<div itemprop="email">pparthiv2412@gmail.com</div>
<div itemprop="telephone">7383343029</div>
<div><meta itemprop="birthDate" content="1986-12-24">DOB: 12/24/1986</div>
</div>
Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-7280696971627524629.post-85718193345803463942013-05-29T22:11:00.000-07:002013-05-29T23:35:53.169-07:00jQuery Effects - Hide and Show<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="intro" style="color: #404040; line-height: 20px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Hide, Show, Toggle, Slide, Fade, and Animate. WOW!</span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Examples</span></h2>
<div style="line-height: 16.363636016845703px;">
</div>
<div style="text-align: justify;">
<a href="http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_hide" style="color: black; font-family: Verdana, sans-serif; line-height: 16.363636016845703px;" target="_blank">jQuery hide()</a></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<span style="line-height: 16.363636016845703px;">Demonstrates a simple jQuery hide() method.</span></div>
<div style="text-align: justify;">
<span style="line-height: 16.363636016845703px;"><br /></span></div>
</span><br />
<div style="line-height: 16.363636016845703px;">
</div>
<div style="text-align: justify;">
<a href="http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_hide_explanations" style="color: black; font-family: Verdana, sans-serif; line-height: 16.363636016845703px;" target="_blank">jQuery hide()</a></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<span style="line-height: 16.363636016845703px;">Another hide() demonstration. How to hide parts of text.</span></div>
</span><br />
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery hide() and show()</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">With jQuery, you can hide and show HTML elements with the hide() and show() methods:</span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 635px">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("#hide").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$("p").hide();</div>
<div style="text-align: justify;">
});</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
$("#show").click(function(){</div>
<div style="text-align: justify;">
$("p").show();</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">Syntax:</span></b></div>
<div class="code notranslate" style="background-color: #f6f4f0; border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 635px;">
<div style="color: #444444; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$(</span><i style="font-family: Verdana, sans-serif;">selector</i><span style="font-family: Verdana, sans-serif;">).hide(</span><i style="font-family: Verdana, sans-serif;">speed,callback</i><span style="font-family: Verdana, sans-serif;">);</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<span style="color: #444444;"><br /></span></div>
<span style="color: #444444;"><div style="text-align: justify;">
$(<i>selector</i>).show(<i>speed,callback</i>);</div>
</span></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional speed parameter specifies the speed of the hiding/showing, and can take the following values: "slow", "fast", or milliseconds.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional callback parameter is a function to be executed after the hide() or show() method completes (you will learn more about callback functions in a later chapter).</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The following example demonstrates the speed parameter with hide():</span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 635px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("button").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$("p").hide(1000);</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span><hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery toggle()</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">With jQuery, you can toggle between the hide() and show() methods with the toggle() method.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Shown elements are hidden and hidden elements are shown:</span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 635px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("button").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$("p").toggle();</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b style="line-height: 16.363636016845703px;"><span style="font-family: Verdana, sans-serif;"><br /></span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b style="line-height: 16.363636016845703px;"><span style="font-family: Verdana, sans-serif;">Syntax:</span></b></div>
<div class="code notranslate" style="background-color: #f6f4f0; border: 1px solid rgb(212, 212, 212); color: #444444; margin: 0px; padding: 5px; width: 635px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$(<i>selector</i>).toggle(<i>speed,callback</i>);</span></div>
</div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional speed parameter can take the following values: "slow", "fast", or milliseconds.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The optional callback parameter is a function to be executed after toggle() completes.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="text-align: justify;">
<a href="https://plus.google.com/u/0/106212648989926698410?rel=author" style="background-color: white; border: 0px; color: #1d92a3; line-height: 21px; margin: 0px; outline: none; padding: 0px; text-decoration: none; vertical-align: baseline;"><span style="font-family: Verdana, sans-serif;">-By Parthiv Patel</span></a></div>
</div>
<div itemscope itemtype="http://schema.org/Person">
<div itemprop="name"><strong>Parthiv Patel</strong></div>
<div itemscope itemtype="http://schema.org/Organization"><span itemprop="name">Bhaishri Info Solution</span></div><div itemprop="jobtitle">Sr. PHP Developer</div>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<div itemprop="streetAddress">Limdi Chowk, AT PO. Nar, Di. Anand</div>
<div><span itemprop="addressLocality">Nar</span>, <span itemprop="addressRegion">Gujarat</span></div><div itemprop="postalCode">388150</div>
<div itemprop="addressCountry">India</div>
</div>
<div itemprop="email">pparthiv2412@gmail.com</div>
<div itemprop="telephone">7383343029</div>
<div><meta itemprop="birthDate" content="1986-12-24">DOB: 12/24/1986</div>
</div>
Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-7280696971627524629.post-20135362923160430462013-05-29T22:03:00.000-07:002013-05-29T23:36:03.307-07:00jQuery Event Methods<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="intro" style="color: #404040; line-height: 20px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">jQuery is tailor-made to respond to events in an HTML page.</span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">What are Events?</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">All the different visitor's actions that a web page can respond to are called events.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">An event represents the precise moment when something happens.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Examples:</span></div>
<ul style="line-height: 16.363636016845703px;">
<li style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">moving a mouse over an element</span></li>
<li style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">selecting a radio button</span></li>
<li style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">clicking on an element</span></li>
</ul>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The term <b>"fires"</b> is often used with events. Example: "The keypress event fires the moment you press a key".</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Here are some common DOM events: </span></div>
<table class="reference notranslate" style="border-collapse: collapse; color: black; text-align: justify; width: 721.8181762695313px;"><tbody>
<tr style="background-color: #f6f4f0;"><th align="left" style="background-color: #555555; border: 1px solid rgb(85, 85, 85); color: white; padding: 3px; vertical-align: top;" width="23%"><span style="font-family: Verdana, sans-serif;">Mouse Events</span></th><th align="left" style="background-color: #555555; border: 1px solid rgb(85, 85, 85); color: white; padding: 3px; vertical-align: top;" width="25%"><span style="font-family: Verdana, sans-serif;">Keyboard Events</span></th><th align="left" style="background-color: #555555; border: 1px solid rgb(85, 85, 85); color: white; padding: 3px; vertical-align: top;" width="22%"><span style="font-family: Verdana, sans-serif;">Form Events</span></th><th align="left" style="background-color: #555555; border: 1px solid rgb(85, 85, 85); color: white; padding: 3px; vertical-align: top;" width="30%"><span style="font-family: Verdana, sans-serif;">Document/Window Events</span></th></tr>
<tr style="background-color: white;"><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">click</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">keypress</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">submit</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">load</span></td></tr>
<tr style="background-color: #f6f4f0;"><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">dblclick</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">keydown</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">change</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">resize</span></td></tr>
<tr style="background-color: white;"><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">mouseenter</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">keyup</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">focus</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">scroll</span></td></tr>
<tr style="background-color: #f6f4f0;"><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">mouseleave</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;"> </span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">blur</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">unload</span></td></tr>
</tbody></table>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery Syntax For Event Methods</span></h2>
<div>
<span style="font-family: Verdana, sans-serif; font-size: small;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">In jQuery, most DOM events have an equivalent jQuery method.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">To assign a click event to all paragraphs on a page, you can do this:</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="code notranslate" style="background-color: #f6f4f0; border: 1px solid rgb(212, 212, 212); color: #444444; margin: 0px; padding: 5px; width: 711px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("p").click();</span></div>
</div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The next step is to define what should happen when the event fires. You must pass a function to the event:</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="code notranslate" style="background-color: #f6f4f0; border: 1px solid rgb(212, 212, 212); color: #444444; margin: 0px; padding: 5px; width: 711px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("p").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
// action goes here!!</div>
<div style="text-align: justify;">
});</div>
</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Commonly Used jQuery Event Methods</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">$(document).ready()</span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The $(document).ready() method allows us to execute a function when the document is fully loaded. This event is already explained in the <a href="http://www.w3schools.com/jquery/jquery_syntax.asp" style="color: black;">jQuery Syntax</a> chapter.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;"><br /></span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">click()</span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The click() method attaches an event handler function to an HTML element.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The function is executed when the user clicks on the HTML element.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The following example says: When a click event fires on a <p> element; hide the current <p> element:</span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("p").click(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$(this).hide();</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;"><br /></span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">dblclick()</span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The dbclick() method attaches an event handler function to an HTML element.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The function is executed when the user double-clicks on the HTML element:</span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("p").dblclick(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$(this).hide();</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;"><br /></span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">mouseenter()</span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The mouseenter() method attaches an event handler function to an HTML element.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The function is executed when the mouse pointer enters the HTML element:</span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("#p1").mouseenter(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
alert("You entered p1!");</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;"><br /></span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">mouseleave()</span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The mouseleave() method attaches an event handler function to an HTML element.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The function is executed when the mouse pointer leaves the HTML element:</span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("#p1").mouseleave(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
alert("Bye! You now leave p1!");</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;"><br /></span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">mousedown()</span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The mousedown() method attaches an event handler function to an HTML element.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The function is executed, when the left mouse button is pressed down, while the mouse is over the HTML element:</span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("#p1").mousedown(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
alert("Mouse down over p1!");</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;"><br /></span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">mouseup()</span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The mouseup() method attaches an event handler function to an HTML element.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The function is executed, when the left mouse button is released, while the mouse is over the HTML element:</span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("#p1").mouseup(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
alert("Mouse up over p1!");</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;"><br /></span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">hover()</span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The hover() method takes two functions and is a combination of the mouseenter() and mouseleave() methods.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The first function is executed when the mouse enters the HTML element, and the second function is executed when the mouse leaves the HTML element:</span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("#p1").hover(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
alert("You entered p1!");</div>
<div style="text-align: justify;">
},</div>
<div style="text-align: justify;">
function(){</div>
<div style="text-align: justify;">
alert("Bye! You now leave p1!");</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;"><br /></span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">focus()</span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The focus() method attaches an event handler function to an HTML form field.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The function is executed when the form field gets focus:</span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("input").focus(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$(this).css("background-color","#cccccc");</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;"><br /></span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">blur()</span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The blur() method attaches an event handler function to an HTML form field.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The function is executed when the form field loses focus:</span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("input").blur(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$(this).css("background-color","#ffffff");</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery Event Methods</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">For a full jQuery event reference, please go to our <a href="http://www.w3schools.com/jquery/jquery_ref_events.asp" style="color: black;">jQuery Events Reference</a>.</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="chapter" style="height: 20px; margin: 0px; padding: 0px; width: 722.9971313476563px;">
<div class="prev" style="float: left; text-align: justify; width: 289.1903381347656px;">
<a href="https://plus.google.com/u/0/106212648989926698410?rel=author" style="background-color: white; border: 0px; color: #1d92a3; font-family: Verdana, sans-serif; font-size: 11px; line-height: 21px; margin: 0px; outline: none; padding: 0px; text-align: start; text-decoration: none; vertical-align: baseline;">-By Parthiv Patel</a></div>
</div>
</div>
<div itemscope itemtype="http://schema.org/Person">
<div itemprop="name"><strong>Parthiv Patel</strong></div>
<div itemscope itemtype="http://schema.org/Organization"><span itemprop="name">Bhaishri Info Solution</span></div><div itemprop="jobtitle">Sr. PHP Developer</div>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<div itemprop="streetAddress">Limdi Chowk, AT PO. Nar, Di. Anand</div>
<div><span itemprop="addressLocality">Nar</span>, <span itemprop="addressRegion">Gujarat</span></div><div itemprop="postalCode">388150</div>
<div itemprop="addressCountry">India</div>
</div>
<div itemprop="email">pparthiv2412@gmail.com</div>
<div itemprop="telephone">7383343029</div>
<div><meta itemprop="birthDate" content="1986-12-24">DOB: 12/24/1986</div>
</div>
Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-7280696971627524629.post-83552865543835313332013-05-29T21:59:00.002-07:002013-05-29T23:36:15.338-07:00jQuery Selectors<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="intro" style="color: #404040; line-height: 20px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">jQuery selectors are one of the most important parts of the jQuery library.</span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery Selectors</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">jQuery selectors allow you to select and manipulate HTML element(s).</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">jQuery selectors are used to "find" (or select) HTML elements based on their id, classes, types, attributes, values of attributes and much more. It's based on the existing <a href="http://www.w3schools.com/cssref/css_selectors.asp" style="color: black;">CSS Selectors</a>, and in addition, it has some own custom selectors.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">All selectors in jQuery start with the dollar sign and parentheses: $().</span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">The element Selector</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The jQuery element selector selects elements based on the element name.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">You can select all <p> elements on a page like this:</span></div>
<div class="code notranslate" style="background-color: #f6f4f0; border: 1px solid rgb(212, 212, 212); color: #444444; margin: 0px; padding: 5px; width: 711px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("p")</span></div>
</div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">Example</span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">When a user clicks on a button, all <p> elements will be hidden:</span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$(document).ready(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$("button").click(function(){</div>
<div style="text-align: justify;">
$("p").hide();</div>
<div style="text-align: justify;">
});</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">The #id Selector</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The jQuery #id selector uses the id attribute of an HTML tag to find the specific element.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">An id should be unique within a page, so you should use the #id selector when you want to find a single, unique element.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">To find an element with a specific id, write a hash character, followed by the id of the element:</span></div>
<div class="code notranslate" style="background-color: #f6f4f0; border: 1px solid rgb(212, 212, 212); color: #444444; margin: 0px; padding: 5px; width: 711px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("#test")</span></div>
</div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">Example</span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">When a user clicks on a button, the element with id="test" will be hidden:</span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$(document).ready(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$("button").click(function(){</div>
<div style="text-align: justify;">
$("#test").hide();</div>
<div style="text-align: justify;">
});</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">The .class Selector</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The jQuery class selector finds elements with a specific class.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">To find elements with a specific class, write a period character, followed by the name of the class:</span></div>
<div class="code notranslate" style="background-color: #f6f4f0; border: 1px solid rgb(212, 212, 212); color: #444444; margin: 0px; padding: 5px; width: 711px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$(".test")</span></div>
</div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<b><span style="font-family: Verdana, sans-serif;">Example</span></b></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">When a user clicks on a button, the elements with class="test" will be hidden:</span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$(document).ready(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
$("button").click(function(){</div>
<div style="text-align: justify;">
$(".test").hide();</div>
<div style="text-align: justify;">
});</div>
<div style="text-align: justify;">
});</div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">More Examples of jQuery Selectors</span></h2>
<table class="reference notranslate" style="border-collapse: collapse; color: black; text-align: justify; width: 721.8181762695313px;"><tbody>
<tr style="background-color: #f6f4f0;"><th align="left" style="background-color: #555555; border: 1px solid rgb(85, 85, 85); color: white; padding: 3px; vertical-align: top;" width="25%"><span style="font-family: Verdana, sans-serif;">Syntax</span></th><th align="left" style="background-color: #555555; border: 1px solid rgb(85, 85, 85); color: white; padding: 3px; vertical-align: top;" width="65%"><span style="font-family: Verdana, sans-serif;">Description</span></th><th align="left" style="background-color: #555555; border: 1px solid rgb(85, 85, 85); color: white; padding: 3px; vertical-align: top;" width="10%"><span style="font-family: Verdana, sans-serif;">TRY IT</span></th></tr>
<tr style="background-color: white;"><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">$("*")</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Selects all elements</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Try it</span></td></tr>
<tr style="background-color: #f6f4f0;"><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">$(this)</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Selects the current HTML element</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Try it</span></td></tr>
<tr style="background-color: white;"><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">$("p.intro")</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Selects all <p> elements with class="intro"</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Try it</span></td></tr>
<tr style="background-color: #f6f4f0;"><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">$("p:first")</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Selects the first <p> element</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Try it</span></td></tr>
<tr style="background-color: white;"><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">$("ul li:first")</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Selects the first <li> element of the first <ul></span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Try it</span></td></tr>
<tr style="background-color: #f6f4f0;"><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">$("ul li:first-child")</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Selects the first <li> element of every <ul></span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Try it</span></td></tr>
<tr style="background-color: white;"><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">$("[href]")</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Selects all elements with an href attribute</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Try it</span></td></tr>
<tr style="background-color: #f6f4f0;"><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">$("a[target='_blank']")</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Selects all <a> elements with a target attribute value equal to "_blank"</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Try it</span></td></tr>
<tr style="background-color: white;"><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">$("a[target!='_blank']")</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Selects all <a> elements with a target attribute value NOT equal to "_blank"</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Try it</span></td></tr>
<tr style="background-color: #f6f4f0;"><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">$(":button")</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Selects all <button> elements and <input> elements of type="button"</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Try it</span></td></tr>
<tr style="background-color: white;"><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">$("tr:even")</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Selects all even <tr> elements</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Try it</span></td></tr>
<tr style="background-color: #f6f4f0;"><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">$("tr:odd")</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Selects all odd <tr> elements</span></td><td style="border: 1px solid rgb(212, 212, 212); line-height: 16.363636016845703px; padding: 7px 5px; vertical-align: top;"><span style="font-family: Verdana, sans-serif;">Try it</span></td></tr>
</tbody></table>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Use our <a href="http://www.w3schools.com/jquery/trysel.asp?filename=trysel_basic&jqsel=p.intro,%23choose" style="color: black;" target="_blank">jQuery Selector Tester</a> to experiment with the different selectors.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">For a complete reference of all the jQuery selectors, please go to our <a href="http://www.w3schools.com/jquery/jquery_ref_selectors.asp" style="color: black;">jQuery Selectors Reference</a>.</span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Functions In a Separate File</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">If your website contains a lot of pages, and you want your jQuery functions to be easy to maintain, you can put your jQuery functions in a separate .js file.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">When we demonstrate jQuery in this tutorial, the functions are added directly into the <head> section. However, sometimes it is preferable to place them in a separate file, like this (use the src attribute to refer to the .js file):</span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Example</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><head></span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></div>
<div style="text-align: justify;">
</script></div>
<span class="marked" style="background-color: transparent; color: #e80000;"><div style="text-align: justify;">
<span style="background-color: transparent;"><script src="my_jquery_functions.js"></script></span></div>
</span><div style="text-align: justify;">
</head></div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<br />
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span><br />
<div class="chapter" style="height: 20px; margin: 0px; padding: 0px; text-align: justify; width: 722.9971313476563px;">
<a href="https://plus.google.com/u/0/106212648989926698410?rel=author" style="background-color: white; border: 0px; color: #1d92a3; line-height: 21px; margin: 0px; outline: none; padding: 0px; text-decoration: none; vertical-align: baseline;"><span style="font-family: Verdana, sans-serif;">-By Parthiv Patel</span></a></div>
</div>
<div itemscope itemtype="http://schema.org/Person">
<div itemprop="name"><strong>Parthiv Patel</strong></div>
<div itemscope itemtype="http://schema.org/Organization"><span itemprop="name">Bhaishri Info Solution</span></div><div itemprop="jobtitle">Sr. PHP Developer</div>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<div itemprop="streetAddress">Limdi Chowk, AT PO. Nar, Di. Anand</div>
<div><span itemprop="addressLocality">Nar</span>, <span itemprop="addressRegion">Gujarat</span></div><div itemprop="postalCode">388150</div>
<div itemprop="addressCountry">India</div>
</div>
<div itemprop="email">pparthiv2412@gmail.com</div>
<div itemprop="telephone">7383343029</div>
<div><meta itemprop="birthDate" content="1986-12-24">DOB: 12/24/1986</div>
</div>
Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-7280696971627524629.post-75488000898038351252013-05-29T21:55:00.002-07:002013-05-29T23:36:22.977-07:00jQuery Syntax<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="intro" style="color: #404040; line-height: 20px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">With jQuery you select (query) HTML elements and perform "actions" on them.</span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">jQuery Syntax</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The jQuery syntax is tailor made for <b>selecting</b> HTML elements and performing some <b>action</b> on the element(s).</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Basic syntax is: <b>$(<i>selector</i>).<i>action</i>()</b></span></div>
<ul style="line-height: 16.363636016845703px;">
<li style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">A $ sign to define/access jQuery</span></li>
<li style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">A (<i>selector</i>) to "query (or find)" HTML elements</span></li>
<li style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">A jQuery <i>action</i>() to be performed on the element(s)</span></li>
</ul>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Examples:</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$(this).hide() - hides the current element.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("p").hide() - hides all <p> elements.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$(".test").hide() - hides all elements with class="test".</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$("#test").hide() - hides the element with id="test".</span></div>
<table class="lamp" style="border: 1px solid rgb(212, 212, 212); color: black; padding: 0px; text-align: justify; width: 720.9090576171875px;"><tbody>
<tr><th style="background-color: white; padding: 10px 5px 10px 10px;" width="34"></th><td style="background-color: white; line-height: 16.363636016845703px; padding: 4px 10px 4px 0px;"><span style="font-family: Verdana, sans-serif;"><b>Are you familiar with CSS selectors?</b><br /><br />jQuery uses CSS syntax to select elements. You will learn more about the selector syntax in the next chapter of this tutorial.</span></td></tr>
</tbody></table>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">The Document Ready Event</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">You might have noticed that all jQuery methods in our examples, are inside a document ready event:</span></div>
<div class="code notranslate" style="background-color: #f6f4f0; border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<div style="color: #444444; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$(document).ready(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<span style="color: #444444;"><br /></span></div>
<span style="color: #444444;"><div style="text-align: justify;">
<i>// jQuery methods go here...</i></div>
</span><div style="text-align: justify;">
<br /></div>
<span style="color: #444444;"><div style="text-align: justify;">
});</div>
</span></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">This is to prevent any jQuery code from running before the document is finished loading (is ready).</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">It is good practice to wait for the document to be fully loaded and ready before working with it. This also allows you to have your JavaScript code before the body of your document, in the head section.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Here are some examples of actions that can fail if methods are run before the document is fully loaded:</span></div>
<ul style="line-height: 16.363636016845703px;">
<li style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">Trying to hide an element that is not created yet</span></li>
<li style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">Trying to get the size of an image that is not loaded yet</span></li>
</ul>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><b>Tip:</b> The jQuery team has also created an even shorter method for the document ready event:</span></div>
<div class="code notranslate" style="background-color: #f6f4f0; border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<div style="color: #444444; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">$(function(){</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<span style="color: #444444;"><br /></span></div>
<span style="color: #444444;"><div style="text-align: justify;">
<i>// jQuery methods go here...</i></div>
</span><div style="text-align: justify;">
<br /></div>
<span style="color: #444444;"><div style="text-align: justify;">
});</div>
</span></span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Use the syntax you prefer. We think that the document ready event is easier to understand when reading the code.</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="chapter" style="height: 20px; margin: 0px; padding: 0px; width: 722.9971313476563px;">
<div class="prev" style="float: left; text-align: justify; width: 289.1903381347656px;">
<a href="https://plus.google.com/u/0/106212648989926698410?rel=author" style="background-color: white; border: 0px; color: #1d92a3; line-height: 21px; margin: 0px; outline: none; padding: 0px; text-decoration: none; vertical-align: baseline;"><span style="font-family: Verdana, sans-serif;">-By Parthiv Patel</span></a></div>
</div>
</div>
<div itemscope itemtype="http://schema.org/Person">
<div itemprop="name"><strong>Parthiv Patel</strong></div>
<div itemscope itemtype="http://schema.org/Organization"><span itemprop="name">Bhaishri Info Solution</span></div><div itemprop="jobtitle">Sr. PHP Developer</div>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<div itemprop="streetAddress">Limdi Chowk, AT PO. Nar, Di. Anand</div>
<div><span itemprop="addressLocality">Nar</span>, <span itemprop="addressRegion">Gujarat</span></div><div itemprop="postalCode">388150</div>
<div itemprop="addressCountry">India</div>
</div>
<div itemprop="email">pparthiv2412@gmail.com</div>
<div itemprop="telephone">7383343029</div>
<div><meta itemprop="birthDate" content="1986-12-24">DOB: 12/24/1986</div>
</div>
Anonymousnoreply@blogger.com0tag:blogger.com,1999:blog-7280696971627524629.post-84863249768088505612013-05-29T21:53:00.002-07:002013-05-29T23:36:32.879-07:00jQuery Install<div dir="ltr" style="text-align: left;" trbidi="on">
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Adding jQuery to Your Web Pages</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">There are several ways to start using jQuery on your web site. You can:</span></div>
<ul style="line-height: 16.363636016845703px;">
<li style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">Download the jQuery library from jQuery.com</span></li>
<li style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">Include jQuery from a CDN, like Google</span></li>
</ul>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Downloading jQuery</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">There are two versions of jQuery available for downloading:</span></div>
<ul style="line-height: 16.363636016845703px;">
<li style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">Production version - this is for your live website because it has been minified and compressed</span></li>
<li style="text-align: justify;"><span style="font-family: Verdana, sans-serif;">Development version - this is for testing and development (uncompressed and readable code)</span></li>
</ul>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Both versions can be downloaded from <a href="http://jquery.com/download/" style="color: black;" target="_blank">jQuery.com</a>.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">The jQuery library is a single JavaScript file, and you reference it with the HTML <script> tag (notice that the <script> tag should be inside the <head> section):</span></div>
<div class="code notranslate" style="background-color: #f6f4f0; border: 1px solid rgb(212, 212, 212); color: #444444; margin: 0px; padding: 5px; width: 711px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><head></span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<script src="jquery-1.9.1.min.js"></script></div>
<div style="text-align: justify;">
</head></div>
</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><b>Tip:</b> Place the downloaded file in the same directory as the pages where you wish to use it.</span></div>
<table class="lamp" id="table1" style="border: 1px solid rgb(212, 212, 212); color: black; padding: 0px; text-align: justify; width: 720.9090576171875px;"><tbody>
<tr><th style="background-color: white; padding: 10px 5px 10px 10px;" width="34"></th><td style="background-color: white; line-height: 16.363636016845703px; padding: 4px 10px 4px 0px;"><span style="font-family: Verdana, sans-serif;"><b>Do you wonder why we do not have type="text/javascript" inside the <script> tag?</b><br /><br />This is not required in HTML5. JavaScript is the default scripting language in HTML5 and in all modern browsers!</span></td></tr>
</tbody></table>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<hr style="background-color: #d4d4d4; border: 0px; clear: both; color: #d4d4d4; height: 1px; text-align: justify;" />
<h2 style="font-weight: normal; margin-bottom: 10px; margin-top: 10px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Alternatives to Downloading</span></h2>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">If you don't want to download and host jQuery yourself, you can include it from a CDN (Content Delivery Network).</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">Both Google and Microsoft host jQuery.</span></div>
<div style="line-height: 16.363636016845703px; text-align: justify;">
<span style="font-family: Verdana, sans-serif;">To use jQuery from Google or Microsoft, use one of the following:</span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Google CDN:</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><head></span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></div>
<div style="text-align: justify;">
</script></div>
<div style="text-align: justify;">
</head></div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<table class="lamp" style="border: 1px solid rgb(212, 212, 212); color: black; padding: 0px; text-align: justify; width: 720.9090576171875px;"><tbody>
<tr><th style="background-color: white; padding: 10px 5px 10px 10px;" width="34"><span style="font-family: Verdana, sans-serif;"></span></th><td style="background-color: white; line-height: 16.363636016845703px; padding: 4px 10px 4px 0px;"><span style="font-family: Verdana, sans-serif;"><b>Get the latest available version with Google CDN:</b><br /><br />If you look at the Google URL above - the version of jQuery is specified in the URL (1.9.1). If you would like to use the latest version of jQuery, you can either remove a number from the end of the version string (for example 1.9), then Google will return the latest version available in the 1.9 series (1.9.0, 1.9.1, etc.), or you can take it up to the whole number (1), and Google will return the latest version available in the 1 series (from 1.1.0 to 1.9.9).</span></td></tr>
</tbody></table>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="example" style="background-color: #e5eecc; background-image: linear-gradient(rgb(255, 255, 255), rgb(229, 238, 204) 100px); border: 1px solid rgb(212, 212, 212); margin: 0px; padding: 5px; width: 711px;">
<h2 class="example" style="background-color: transparent; color: #617f10; font-weight: normal; margin-bottom: 10px; margin-top: 0px; text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: small;">Microsoft CDN:</span></h2>
<div class="example_code notranslate" style="background-color: white; border: 1px solid rgb(212, 212, 212); padding: 5px; width: 696.7613525390625px;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><head></span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js"></div>
<div style="text-align: justify;">
</script></div>
<div style="text-align: justify;">
</head></div>
</span></div>
<span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<br /></div>
</span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<table class="lamp" style="border: 1px solid rgb(212, 212, 212); color: black; padding: 0px; text-align: justify; width: 720.9090576171875px;"><tbody>
<tr><th style="background-color: white; padding: 10px 5px 10px 10px;" width="34"><span style="font-family: Verdana, sans-serif;"></span></th><td style="background-color: white; line-height: 16.363636016845703px; padding: 4px 10px 4px 0px;"><span style="font-family: Verdana, sans-serif;"><b>One big advantage of using the hosted jQuery from Google or Microsoft:</b><br /><br />Many users already have downloaded jQuery from Google or Microsoft when visiting another site. As a result, it will be loaded from cache when they visit your site, which leads to faster loading time. Also, most CDN's will make sure that once a user requests a file from it, it will be served from the server closest to them, which also leads to faster loading time.</span></td></tr>
</tbody></table>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div style="background-color: white; border: 0px; color: #1d92a3; line-height: 21px; margin: 0px; outline: none; padding: 0px; text-align: justify; text-decoration: none; vertical-align: baseline;">
<a href="https://plus.google.com/u/0/106212648989926698410?rel=author" style="border: 0px; color: #1d92a3; margin: 0px; outline: none; padding: 0px; text-decoration: none; vertical-align: baseline;"><span style="font-family: Verdana, sans-serif;">-By Parthiv Patel</span></a></div>
</div>
<div itemscope itemtype="http://schema.org/Person">
<div itemprop="name"><strong>Parthiv Patel</strong></div>
<div itemscope itemtype="http://schema.org/Organization"><span itemprop="name">Bhaishri Info Solution</span></div><div itemprop="jobtitle">Sr. PHP Developer</div>
<div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
<div itemprop="streetAddress">Limdi Chowk, AT PO. Nar, Di. Anand</div>
<div><span itemprop="addressLocality">Nar</span>, <span itemprop="addressRegion">Gujarat</span></div><div itemprop="postalCode">388150</div>
<div itemprop="addressCountry">India</div>
</div>
<div itemprop="email">pparthiv2412@gmail.com</div>
<div itemprop="telephone">7383343029</div>
<div><meta itemprop="birthDate" content="1986-12-24">DOB: 12/24/1986</div>
</div>
Anonymousnoreply@blogger.com0