<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5173447009686155144</id><updated>2012-02-10T18:34:13.529+05:30</updated><category term='php error report'/><category term='overloading in php'/><category term='interview questions'/><category term='contextmenu'/><category term='PHP variable scope'/><category term='functions'/><category term='date'/><category term='syntax'/><category term='JAvascript'/><category term='array'/><category term='Class Abstraction in PHP'/><category term='mouse'/><category term='css'/><category term='copy'/><category term='drag'/><category term='unescape'/><category term='username'/><category term='get'/><category term='variable scope'/><category term='gif'/><category term='checkbox'/><category term='mktime'/><category term='type'/><category term='mysql'/><category term='java'/><category term='overload'/><category term='paste'/><category term='wakeup'/><category term='php  object'/><category term='checkbox in jquery'/><category term='right click'/><category term='php function'/><category term='xmlhttp'/><category term='loading image'/><category term='set state'/><category term='decodes'/><category term='div scroll contents on mouseover'/><category term='interview'/><category term='last day'/><category term='escape'/><category term='html'/><category term='reference'/><category term='tostring'/><category term='php oops - object oriented programming languages'/><category term='mouseover'/><category term='request'/><category term='last month'/><category term='error repoert'/><category term='Extending Exceptions'/><category term='constructors in php'/><category term='previous month'/><category term='url'/><category term='answers'/><category term='operator'/><category term='Function arguments'/><category term='month'/><category term='google api'/><category term='Static Keyword in PHP'/><category term='icon generators'/><category term='cloning'/><category term='autocomplete off'/><category term='input'/><category term='curve shape'/><category term='preloading'/><category term='Ajax'/><category term='ajax interview question and answers'/><category term='string'/><category term='sleep'/><category term='drop'/><category term='Constructor'/><category term='spilt'/><category term='function reference'/><category term='login screen'/><category term='html interview question and answers'/><category term='overloading'/><category term='script'/><category term='date functions'/><category term='php 6.0'/><category term='Declare Control Structure in php'/><category term='Variable functions in PHP'/><category term='php ajax'/><category term='encodes'/><category term='Function arguments in PHP'/><category term='disable right click'/><category term='php'/><category term='php object clone'/><category term='jsp'/><category term='syntax in jsp'/><category term='Predefined variables'/><category term='post'/><category term='mysql interview questions'/><category term='strcasecmp'/><category term='php interview questions and answers'/><category term='textbox'/><category term='click'/><category term='jquery'/><category term='clone'/><category term='array functions in php'/><category term='div'/><category term='icon'/><category term='Internal (built-in) functions'/><category term='search'/><category term='div scroll'/><category term='questions'/><category term='password'/><title type='text'>murugan senthil</title><subtitle type='html'>...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>46</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-2980017371470433574</id><published>2011-08-25T19:05:00.000+05:30</published><updated>2011-08-25T19:05:13.817+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='checkbox in jquery'/><category scheme='http://www.blogger.com/atom/ns#' term='checkbox'/><category scheme='http://www.blogger.com/atom/ns#' term='jquery'/><title type='text'>Get Values from Checkbox in Jquery</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;$('#checkBox').attr('checked'); &lt;br /&gt;&lt;br /&gt;$('#edit-checkbox-id').is(':checked');&lt;br /&gt;&lt;br /&gt;var checked = $('input[type=checkbox]').is(':checked');&lt;br /&gt;&lt;br /&gt;var checkbox_value = $('#check_box_id:checked').val();&lt;br /&gt;&lt;br /&gt;$("input[@type=checkbox][@checked]").each( &lt;br /&gt;&lt;br /&gt;function() { &lt;br /&gt;&amp;nbsp; &amp;nbsp;// Insert code here &lt;br /&gt;&amp;nbsp; &amp;nbsp;} &lt;br /&gt;&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;//&lt;br /&gt;$("input[type=checkbox][checked]").each( &lt;br /&gt;&lt;br /&gt;function() { &lt;br /&gt;&amp;nbsp; &amp;nbsp;// Insert code here &lt;br /&gt;&amp;nbsp; &amp;nbsp;} &lt;br /&gt;);&lt;br /&gt;$('input[name=foo]').is(':checked')&lt;br /&gt;$('input[name=foo]').attr('checked')&lt;br /&gt;$('input[name=foo]').attr('checked', true);&lt;br /&gt;$('input[name=foo]').attr('checked', false);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;$(document).ready(function(){&lt;br /&gt;&lt;br /&gt;$('#submit_button').click(function() {&lt;br /&gt;&lt;br /&gt;if (!$("input[@name='name']:checked").val()) {&lt;br /&gt;&amp;nbsp; &amp;nbsp;alert('Nothing is checked!');&lt;br /&gt;&amp;nbsp; &amp;nbsp;return false;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;else {&lt;br /&gt;&amp;nbsp; &amp;nbsp;alert('One of the radio buttons is checked!');&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;});&lt;br /&gt;});&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-2980017371470433574?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/2980017371470433574/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2011/08/get-values-from-checkbox-in-jquery.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/2980017371470433574'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/2980017371470433574'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2011/08/get-values-from-checkbox-in-jquery.html' title='Get Values from Checkbox in Jquery'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total><georss:featurename>Quatre Bornes, Mauritius</georss:featurename><georss:point>-20.258402989767298 57.48418032847212</georss:point><georss:box>-20.286053489767298 57.45445382847212 -20.230752489767298 57.51390682847212</georss:box></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-2400551364712280515</id><published>2011-07-15T18:29:00.000+05:30</published><updated>2011-07-15T18:29:56.034+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='preloading'/><category scheme='http://www.blogger.com/atom/ns#' term='url'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='gif'/><category scheme='http://www.blogger.com/atom/ns#' term='icon'/><category scheme='http://www.blogger.com/atom/ns#' term='icon generators'/><category scheme='http://www.blogger.com/atom/ns#' term='loading image'/><title type='text'>AJAX Loading Icon Generators</title><content type='html'>&lt;b&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Verdana, sans-serif;"&gt;AJAX Loading Icon Generators&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;If you want to inform your website\'s visitor that there are more information to be displayed or still to be loaded on your page, you may need a 'loading' or 'wait' icon. An Ajax loading icon is also most commonly used on AJAX-base sites and applications. Here, we present to you online tools that will generate an AJAX loading icons.&lt;br /&gt;&lt;br /&gt;&lt;h5 style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 10px; text-align: justify;"&gt;&lt;a href="http://preloaders.net/" style="font-weight: bold; text-decoration: none;" target="_blank"&gt;&lt;span class="Apple-style-span" style="color: #274e13;"&gt;Preloaders.net&lt;/span&gt;&lt;/a&gt;&lt;/h5&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #274e13;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h5 style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 10px;"&gt;&lt;a href="http://ajaxload.info/" style="font-weight: bold; text-decoration: none;" target="_blank"&gt;&lt;span class="Apple-style-span" style="color: #274e13;"&gt;Ajaxload&lt;/span&gt;&lt;/a&gt;&lt;/h5&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #274e13;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h5 style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 10px;"&gt;&lt;a href="http://www.loadinfo.net/" style="font-weight: bold; text-decoration: none;" target="_blank"&gt;&lt;span class="Apple-style-span" style="color: #274e13;"&gt;Load Info&lt;/span&gt;&lt;/a&gt;&lt;/h5&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #274e13;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h5 style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 10px;"&gt;&lt;a href="http://www.webscriptlab.com/" style="font-weight: bold; text-decoration: none;" target="_blank"&gt;&lt;span class="Apple-style-span" style="color: #274e13;"&gt;Web Script Lab&lt;/span&gt;&lt;/a&gt;&lt;/h5&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #274e13;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h5 style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 10px;"&gt;&lt;a href="http://www.chimply.com/" style="font-weight: bold; text-decoration: none;" target="_blank"&gt;&lt;span class="Apple-style-span" style="color: #274e13;"&gt;Chimply&lt;/span&gt;&lt;/a&gt;&lt;/h5&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #274e13;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h5 style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 10px;"&gt;&lt;a href="http://mentalized.net/activity-indicators/" style="font-weight: bold; text-decoration: none;" target="_blank"&gt;&lt;span class="Apple-style-span" style="color: #274e13;"&gt;mentalized Activity Indicators&lt;/span&gt;&lt;/a&gt;&lt;/h5&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="color: #274e13;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;h5 style="font-family: Arial, Helvetica, sans-serif; font-size: 16px; line-height: 15px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 10px;"&gt;&lt;a href="http://www.sanbaldo.com/wordpress/1/ajax_gif/" style="font-weight: bold; text-decoration: none;" target="_blank"&gt;&lt;span class="Apple-style-span" style="color: #274e13;"&gt;SanBaldo Ajax Loading Animated GIF&lt;/span&gt;&lt;/a&gt;&lt;/h5&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-2400551364712280515?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/2400551364712280515/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2011/07/ajax-loading-icon-generators.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/2400551364712280515'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/2400551364712280515'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2011/07/ajax-loading-icon-generators.html' title='AJAX Loading Icon Generators'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-6146340136494115176</id><published>2011-07-14T20:00:00.011+05:30</published><updated>2011-07-29T11:15:29.314+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='div'/><category scheme='http://www.blogger.com/atom/ns#' term='jquery'/><category scheme='http://www.blogger.com/atom/ns#' term='div scroll contents on mouseover'/><category scheme='http://www.blogger.com/atom/ns#' term='mouseover'/><category scheme='http://www.blogger.com/atom/ns#' term='mouse'/><category scheme='http://www.blogger.com/atom/ns#' term='JAvascript'/><category scheme='http://www.blogger.com/atom/ns#' term='div scroll'/><title type='text'>Div Scrollable Contents on MouseOver On Javascript</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;pre class="html" name="code"&gt;&lt;script type="text/javascript"&gt;&lt;br /&gt;  var scrolling = null;&lt;br /&gt;  var _speed = 12;&lt;br /&gt;      &lt;br /&gt;  function doScrollUp() &lt;br /&gt;  {&lt;br /&gt;   var d = document.getElementById('scroller');&lt;br /&gt;   d.scrollTop = d.scrollTop - _speed;&lt;br /&gt;  &lt;br /&gt;   scrolling = window.setTimeout(function() {&lt;br /&gt;    doScrollUp();&lt;br /&gt;   }, 100);&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  function doScrollDown() &lt;br /&gt;  {&lt;br /&gt;   var d = document.getElementById('scroller');&lt;br /&gt;   d.scrollTop = d.scrollTop + _speed;&lt;br /&gt;  &lt;br /&gt;   scrolling = window.setTimeout(function() {&lt;br /&gt;    doScrollDown();&lt;br /&gt;   }, 100);&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  function doStopScroll() &lt;br /&gt;  {&lt;br /&gt;   window.clearTimeout(scrolling);&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;&lt;/script&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: green; font-size: 14px;"&gt;&lt;br /&gt;SCROLLABLE DIV CONTENTS WHEN MOUSE OVER THE&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: green; font-size: 14px;"&gt;SCROLL &lt;/span&gt;&lt;span class="Apple-style-span" style="color: green; font-size: 14px;"&gt;UP AND&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: green; font-size: 14px;"&gt;SCROLL &lt;/span&gt;&lt;span class="Apple-style-span" style="color: green; font-size: 14px;"&gt;DOWN LINKS&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="html" name="code"&gt;&lt;div id="scroller" style="height: 100px; overflow: hidden; width: 100%;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;SCROLLABLE DIV CONTENTS WHEN MOUSE OVER THE UP AND DOWN LINKS&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The top-level function, escape, encodes the string that is contained in &lt;br /&gt;&lt;br /&gt;the string argument to make it portable. A string is considered portable &lt;br /&gt;&lt;br /&gt;if it can be transmitted across any network to any computer that &lt;br /&gt;    supports ASCII characters.&lt;br /&gt;We can use escape function in JavaScript to make a string portable&lt;br /&gt;    to transmit it over a network. All the non ASCII characters are to be &lt;br /&gt;converted before sending them by using escape function. The escape function &lt;br /&gt;will replace these non ASCII characters to its two or four digit hex format.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="height: 15px;"&gt;&lt;/div&gt;&lt;div style="float: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span onmouseout="doStopScroll();" onmouseover="doScrollUp();" style="color: darkgreen; font-size: large;"&gt;&lt;b&gt;Scroll Up&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span onmouseout="doStopScroll();" onmouseover="doScrollDown();" style="color: green; font-size: large;"&gt;&lt;b&gt;Scroll Down&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #274e13; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;u&gt;Here Code&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;var scrolling = null;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;var _speed = 12;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;function doScrollUp() &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;var d = document.getElementById('scroller');&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;d.scrollTop = d.scrollTop - _speed;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;scrolling = window.setTimeout(function() {&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;doScrollUp();&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;}, 100);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;function doScrollDown() &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;var d = document.getElementById('scroller');&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;d.scrollTop = d.scrollTop + _speed;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;scrolling = window.setTimeout(function() {&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;doScrollDown();&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;}, 100);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;function doStopScroll() &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;window.clearTimeout(scrolling);&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;lt;h2&amp;gt;SCROLLABLE DIV CONTENTS WHEN MOUSE OVER THE UP AND DOWN LINKS&amp;lt;/h2&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;lt;div id="scroller" style="width:100%; height:100px; overflow:hidden;"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;SCROLLABLE DIV CONTENTS WHEN MOUSE OVER THE UP AND DOWN LINKS&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;The top-level function, escape, encodes the string that is contained in &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;the string argument to make it portable. A string is considered portable &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;if it can be transmitted across any network to any computer that &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;supports ASCII characters.&amp;lt;br /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;We can use escape function in JavaScript to make a string portable&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;to transmit it over a network. All the non ASCII characters are to be &amp;lt;br /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;converted before sending them by using escape function. The escape function &amp;lt;br /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;will replace these non ASCII characters to its two or four digit hex format.&amp;lt;br /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;lt;span style="color:red;" onmouseover="doScrollUp();" onmouseout="doStopScroll();" style="padding-right:10px;"&amp;gt;Scroll Up&amp;lt;/span&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;lt;span style="color:blue;" onmouseover="doScrollDown();" onmouseout="doStopScroll();"&amp;gt;Scroll Down&amp;lt;/span&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-6146340136494115176?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/6146340136494115176/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2011/07/div-scroll-contents-on-mouseover-on.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/6146340136494115176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/6146340136494115176'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2011/07/div-scroll-contents-on-mouseover-on.html' title='Div Scrollable Contents on MouseOver On Javascript'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total><georss:featurename>Quatre Bornes, Mauritius</georss:featurename><georss:point>-20.258754626278236 57.484281383087136</georss:point><georss:box>-20.286405126278236 57.454554883087134 -20.231104126278236 57.51400788308714</georss:box></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-5929897325812997154</id><published>2011-07-12T19:22:00.003+05:30</published><updated>2011-07-29T11:14:36.591+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='escape'/><category scheme='http://www.blogger.com/atom/ns#' term='unescape'/><category scheme='http://www.blogger.com/atom/ns#' term='jquery'/><category scheme='http://www.blogger.com/atom/ns#' term='JAvascript'/><category scheme='http://www.blogger.com/atom/ns#' term='string'/><category scheme='http://www.blogger.com/atom/ns#' term='encodes'/><category scheme='http://www.blogger.com/atom/ns#' term='decodes'/><title type='text'>Escape Function in Javascript or Jquery</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;b&gt;&lt;u&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;Escape Function:&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;The escape() function encodes a string.&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;unescape("you can pass &amp;amp; symbols &amp;amp; any other special characters through query string when you using ajax posting &amp;amp; jquery posting");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;The top-level function, escape, encodes the string that is contained in the string argument to make it portable. A string is considered portable if it can be transmitted across any network to any computer that supports ASCII characters.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;We can use escape function in JavaScript to make a string portable to transmit it over a network. All the non ASCII characters are to be converted before sending them by using escape function. The escape function will replace these non ASCII characters to its two or four digit hex format.  &lt;br /&gt;&amp;nbsp;The escape function converts a blank space into %20, same way it converts &amp;amp; to %26.&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;The unescape() function decodes an encoded string.&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;unescape("you%20can%20pass%20&amp;amp;%20symbols &amp;amp;%20any%20other%20special characters%20through%20query%20string when%20you%20using%20ajax%20posting &amp;amp;%20jquery%20posting");&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-5929897325812997154?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/5929897325812997154/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2011/07/escape-function-in-javascript-or-jquery.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/5929897325812997154'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/5929897325812997154'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2011/07/escape-function-in-javascript-or-jquery.html' title='Escape Function in Javascript or Jquery'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-1281152290834727255</id><published>2011-01-17T21:48:00.000+05:30</published><updated>2011-07-12T15:47:40.860+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='drag'/><category scheme='http://www.blogger.com/atom/ns#' term='type'/><category scheme='http://www.blogger.com/atom/ns#' term='copy'/><category scheme='http://www.blogger.com/atom/ns#' term='input'/><category scheme='http://www.blogger.com/atom/ns#' term='autocomplete off'/><category scheme='http://www.blogger.com/atom/ns#' term='paste'/><category scheme='http://www.blogger.com/atom/ns#' term='drop'/><category scheme='http://www.blogger.com/atom/ns#' term='textbox'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><title type='text'>Disable copy paste and autocomplete for textbox in HTML</title><content type='html'>&lt;b&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;Disable copy paste and autocomplete for textbox in HTML&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;input size="25" name="name" id="name' maxlength="20" onCopy="return false" onDrag="return false" onDrop="return false" onPaste="return false" autocomplete="off" /&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-1281152290834727255?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/1281152290834727255/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2011/01/disable-copy-paste-and-autocomplete-for.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/1281152290834727255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/1281152290834727255'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2011/01/disable-copy-paste-and-autocomplete-for.html' title='Disable copy paste and autocomplete for textbox in HTML'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-48174179306598788</id><published>2011-01-15T17:41:00.001+05:30</published><updated>2011-07-29T11:31:40.054+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='array functions in php'/><category scheme='http://www.blogger.com/atom/ns#' term='password'/><category scheme='http://www.blogger.com/atom/ns#' term='jquery'/><category scheme='http://www.blogger.com/atom/ns#' term='JAvascript'/><category scheme='http://www.blogger.com/atom/ns#' term='username'/><category scheme='http://www.blogger.com/atom/ns#' term='login screen'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='script'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>Login Screen Shaking</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;b&gt;Shaking the Login Screen.&amp;nbsp; when u can refresh the page and submit the page....&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt;&lt;br /&gt;&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; addLoadEvent = function(func){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if (typeof jQuery!="undefined")&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; jQuery(document).ready(func);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; else if ( typeof wpOnload!='function'){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wpOnload=func;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; } else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; var oldonload=wpOnload;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wpOnload=function(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; oldonload();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; func();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; function s(id,pos){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; g(id).left = pos+'px';&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; function g(id){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return document.getElementById(id).style;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; function shake(id,a,d) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; c=a.shift();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; s(id,c);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if(a.length&amp;gt;0){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; setTimeout(function(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; shake(id,a,d);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; },d);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; } else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; g(id).position='static';&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; wp_attempt_focus();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; catch(e){}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; addLoadEvent(function(){ &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; var p = new Array(10, 10, 10, 0, -10, -10, -10, 0);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; p = p.concat(p.concat(p));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; var i = document.forms[0].id;g(i).position='relative';&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; shake(i, p, 20);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;&amp;nbsp; &amp;lt;/script&amp;gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body onload="document.getElementById('username').focus();"&amp;gt;&lt;br /&gt;&amp;lt;table width="90%" cellpadding="0" cellspacing="0" border="0" align="center"&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp;&amp;lt;tr&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;td valign="top"&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;form method="post" action="" name="frmLogin" id="frmLogin"&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;table width="50%" cellpadding="2" cellspacing="2" border="1" align="center"&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;tr&amp;gt;&amp;lt;td height="10px"&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;tr&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;td width="40%"&amp;gt; USERNAME:&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;td width="60%"&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;input type="text" name="username" id="username" autocomplete="off" /&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/td&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;tr&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;td&amp;gt;PASSWORD: &amp;lt;/td&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;td&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;input type="password" name="password" id="password" autocomplete="off" /&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/td&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/tr&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/table&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/form&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;/table&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; function wp_attempt_focus(){&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; setTimeout( function() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; d = document.getElementById('username');&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; d.value = '';&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; d.focus();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; } catch(e){}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }, 200);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wp_attempt_focus();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(typeof wpOnload == 'function')wpOnload();&lt;br /&gt;&amp;nbsp; &amp;lt;/script&amp;gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-48174179306598788?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/48174179306598788/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2011/01/shaking-login-screen.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/48174179306598788'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/48174179306598788'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2011/01/shaking-login-screen.html' title='Login Screen Shaking'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-8853541958236035072</id><published>2011-01-08T15:15:00.000+05:30</published><updated>2011-01-08T15:15:56.976+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='array functions in php'/><category scheme='http://www.blogger.com/atom/ns#' term='php function'/><category scheme='http://www.blogger.com/atom/ns#' term='array'/><category scheme='http://www.blogger.com/atom/ns#' term='strcasecmp'/><title type='text'>Sort An Array of String Without Using PHP Function</title><content type='html'>&lt;b&gt;&lt;span class="Apple-style-span" style="color: #38761d; font-family: 'Trebuchet MS', sans-serif;"&gt;To sort an array of string without using php function?&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;try this...&lt;br /&gt;&lt;br /&gt;$str = array(“Z”,”c”,”A”,”C”,”E”,”B”,”M”,”N”);&lt;br /&gt;$array_length = sizeof($str);&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;for($x = 0; $x &amp;lt; $array_length; $x++) {&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;for($y = 0; $y &amp;lt; $array_length; $y++) {&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;if(strcasecmp($str[$x],$str[$y])&amp;lt;0) {&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;      &lt;/span&gt;$hold = $str[$x];&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;      &lt;/span&gt;$str[$x] = $str[$y];&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;      &lt;/span&gt;$str[$y] = $hold;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;}&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;echo "&amp;lt;pre&amp;gt;”;&lt;br /&gt;print_r($str);&lt;br /&gt;echo “&amp;lt;/pre&amp;gt;”;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-8853541958236035072?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/8853541958236035072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2011/01/sort-array-of-string-without-using-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/8853541958236035072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/8853541958236035072'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2011/01/sort-array-of-string-without-using-php.html' title='Sort An Array of String Without Using PHP Function'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-4947419456414268108</id><published>2011-01-08T13:06:00.000+05:30</published><updated>2011-01-08T14:57:03.740+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='mktime'/><category scheme='http://www.blogger.com/atom/ns#' term='last month'/><category scheme='http://www.blogger.com/atom/ns#' term='date functions'/><category scheme='http://www.blogger.com/atom/ns#' term='previous month'/><category scheme='http://www.blogger.com/atom/ns#' term='spilt'/><category scheme='http://www.blogger.com/atom/ns#' term='month'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='date'/><title type='text'>get last day of the previous month in PHP</title><content type='html'>&lt;div class="MsoNormal" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #6aa84f; font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;b&gt;Get Last Day Of The Previous Month&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Helvetica, sans-serif;"&gt;$date&amp;nbsp;=&amp;nbsp;"2010-12-31";&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Helvetica, sans-serif;"&gt;list($yr,$mn,$dt) &amp;nbsp;= split('-',&amp;nbsp;$date);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// separate year, month and date&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-bottom: 0.0001pt; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #444444;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;$time_stamp &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;= mktime(&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;0&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;0&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;0&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;$mn&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;0&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;$yr&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;);&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;// Create time stamp&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Helvetica, sans-serif;"&gt;$last_month_last_day&amp;nbsp;= date("Y-m-t",&amp;nbsp;$time_stamp);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #444444;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;echo&amp;nbsp;"last_month : "&amp;nbsp;.&amp;nbsp;$last_month"&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Helvetica, sans-serif;"&gt;ouptut : 2010-11-30...&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="color: white;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-4947419456414268108?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/4947419456414268108/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2011/01/get-last-day-of-previous-month-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/4947419456414268108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/4947419456414268108'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2011/01/get-last-day-of-previous-month-in-php.html' title='get last day of the previous month in PHP'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-4688039584873484737</id><published>2011-01-08T13:02:00.000+05:30</published><updated>2011-01-08T14:57:58.351+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='mktime'/><category scheme='http://www.blogger.com/atom/ns#' term='last month'/><category scheme='http://www.blogger.com/atom/ns#' term='date functions'/><category scheme='http://www.blogger.com/atom/ns#' term='month'/><category scheme='http://www.blogger.com/atom/ns#' term='last day'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='date'/><category scheme='http://www.blogger.com/atom/ns#' term='functions'/><title type='text'>get last day of the current month in PHP</title><content type='html'>&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span" style="color: #6aa84f; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;b&gt;Get Last Day Of The Current Month&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px;"&gt;To get the last day of the month so got this piece of code.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Georgia, 'Bitstream Charter', serif; font-size: 16px; line-height: 24px;"&gt;try the following code all are different format....&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Helvetica, sans-serif;"&gt;date('Y-m-d', strtotime('-1 second', strtotime(date('m') . '/01/' . date('Y') . '00:00:00')))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Helvetica, sans-serif;"&gt;date(“Y-m-d”,mktime(0, &amp;nbsp;0, &amp;nbsp;0, (date(‘m’) + 1), 0, date(‘Y’)))&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Helvetica, sans-serif;"&gt;strtotime(‘+1 month -1 second ‘ . date(‘Y’) . ’-’ . date(‘m’) . ’-01′ );&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Helvetica, sans-serif;"&gt;date(“Y-m-t”); //t = number of days in the month&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Helvetica, sans-serif;"&gt;date(“Y-m-d’,mktime(0, 0, 0, &amp;nbsp;2, 32, 2008));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Helvetica, sans-serif;"&gt;date(‘t’,strtotime(“last month”));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span class="Apple-style-span" style="color: #444444; font-family: Arial, Helvetica, sans-serif;"&gt;date(‘D Y-m-t’, strtotime(“last month”))&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-4688039584873484737?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/4688039584873484737/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2011/01/get-last-day-of-current-month-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/4688039584873484737'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/4688039584873484737'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2011/01/get-last-day-of-current-month-in-php.html' title='get last day of the current month in PHP'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-3891413824268615290</id><published>2010-12-02T22:15:00.000+05:30</published><updated>2010-12-02T22:15:37.035+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='right click'/><category scheme='http://www.blogger.com/atom/ns#' term='jquery'/><category scheme='http://www.blogger.com/atom/ns#' term='mouse'/><category scheme='http://www.blogger.com/atom/ns#' term='click'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='disable right click'/><category scheme='http://www.blogger.com/atom/ns#' term='contextmenu'/><title type='text'>Disable Right Click On Web Page Using jQuery</title><content type='html'>&lt;span class="Apple-style-span" style="color: #741b47;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, sans-serif;"&gt;This is code used for disable right click&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&lt;b&gt;$(document).ready(function()&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;{ &lt;/b&gt;&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $(document).bind("contextmenu",function(e){&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return false;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}); &lt;/b&gt;&lt;br /&gt;&lt;b&gt;&amp;nbsp;});&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;This code for disable right click on web pages. It is working all browsers excepted Opera..&lt;br /&gt;try it..&lt;br /&gt;Download add jQuery File . Here it is link &lt;a href="http://jquery.com/"&gt;http://jquery.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', Times, serif; font-size: 19px; font-weight: bold; line-height: 32px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="color: #351c75;"&gt;Disable Right Click Easily using jquery&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, 'Times New Roman', Times, serif; font-size: 19px; font-weight: bold; line-height: 32px;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="color: #351c75;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&amp;lt;html xmlns="http://www.w3.org/1999/xhtml" &amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;jQuery disable right click&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;script language="javascript" type="text/javascript"&amp;nbsp;src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript" language="javascript"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $(function() {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $(this).bind("contextmenu", function(e) {&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;e.preventDefault();&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;br /&gt;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;jQuery disable right Click&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-3891413824268615290?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/3891413824268615290/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2010/12/disable-right-click-on-web-page-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/3891413824268615290'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/3891413824268615290'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2010/12/disable-right-click-on-web-page-using.html' title='Disable Right Click On Web Page Using jQuery'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-2288104314776438312</id><published>2010-12-02T22:04:00.000+05:30</published><updated>2010-12-02T22:04:23.355+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='textbox'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='curve shape'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>TextBox with Curve Shape using CSS</title><content type='html'>&lt;b&gt;&lt;span class="Apple-style-span" style="color: #351c75;"&gt;Textbox with curve shape...&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Create a html textbox. then Add a CSS Class for the textbox.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;The following code&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;input[type="text"] {&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;border: 1px solid #505050; /*#123360;*/&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;font-size: 12px;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;width: 180px;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;height:17px;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;-moz-border-radius:3px;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;-khtml-border-radius:3px;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;-webkit-border-radius:3px;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;border-radius:3px;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-2288104314776438312?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/2288104314776438312/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2010/12/textbox-with-curve-shape-using-css.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/2288104314776438312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/2288104314776438312'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2010/12/textbox-with-curve-shape-using-css.html' title='TextBox with Curve Shape using CSS'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-7926872647642392328</id><published>2010-06-18T17:51:00.000+05:30</published><updated>2010-06-18T17:51:07.536+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='interview questions'/><category scheme='http://www.blogger.com/atom/ns#' term='ajax interview question and answers'/><category scheme='http://www.blogger.com/atom/ns#' term='php ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='interview'/><title type='text'>AJAX Interview Questions and Answers</title><content type='html'>&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;AJAX Interview Questions and&amp;nbsp;Answers&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What’s AJAX?&lt;/b&gt;&lt;br /&gt;AJAX (Asynchronous JavaScript and XML) is a newly coined term for two powerful browser features that have been around for years, but were overlooked by many web developers until recently when applications such as Gmail, Google Suggest, and Google Maps hit the streets.&lt;br /&gt;&lt;br /&gt;Asynchronous JavaScript and XML, or Ajax (pronounced “Aye-Jacks”), is a web development technique for creating interactive web applications using a combination of XHTML (or HTML) and CSS for marking up and styling information. (XML is commonly used, although any format will work, including preformatted HTML, plain text, JSON and even EBML).&lt;br /&gt;The Document Object Model manipulated through JavaScript to dynamically display and interact with the information presented&lt;br /&gt;The XMLHttpRequest object to exchange data asynchronously with the web server. In some Ajax frameworks and in some situations, an IFrame object is used instead of the XMLHttpRequest object to exchange data with the web server.&lt;br /&gt;Like DHTML, LAMP, or SPA, Ajax is not a technology in itself, but a term that refers to the use of a group of technologies together. In fact, derivative/composite technologies based substantially upon Ajax, such as AFLAX, are already appearing.&lt;br /&gt;Ajax applications are mostly executed on the user’s computer; they can perform a number of tasks without their performance being limited by the network. This permits the development of interactive applications, in particular reactive and rich graphic user interfaces.&lt;br /&gt;Ajax applications target a well-documented platform, implemented by all major browsers on most existing platforms. While it is uncertain that this compatibility will resist the advent of the next generations of browsers (in particular, Firefox), at the moment, Ajax applications are effectively cross-platform.&lt;br /&gt;While the Ajax platform is more restricted than the Java platform, current Ajax applications effectively fill part of the one-time niche of Java applets: extending the browser with portable, lightweight mini-applications.&lt;br /&gt;&lt;br /&gt;Ajax isn’t a technology. It’s really several technologies, each flourishing in its own right, coming together in powerful new ways. Ajax incorporates:&lt;br /&gt;* standards-based presentation using XHTML and CSS;&lt;br /&gt;* dynamic display and interaction using the Document Object Model;&lt;br /&gt;* data interchange and manipulation using XML and XSLT;&lt;br /&gt;* asynchronous data retrieval using XMLHttpRequest;&lt;br /&gt;* and JavaScript binding everything together.&lt;br /&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Who’s Using Ajax ?&lt;/b&gt;&lt;br /&gt;Google is making a huge investment in developing the Ajax approach. All of the major products Google has introduced over the last year ? Orkut, Gmail, the latest beta version of Google Groups, Google Suggest, and Google Maps ? are Ajax applications. (For more on the technical nuts and bolts of these Ajax implementations, check out these excellent analyses of Gmail, Google Suggest, and Google Maps.) Others are following suit: many of the features that people love in Flickr depend on Ajax, and Amazon?s A9.com search engine applies similar techniques.&lt;br /&gt;These projects demonstrate that Ajax is not only technically sound, but also practical for real-world applications. This isn?t another technology that only works in a laboratory. And Ajax applications can be any size, from the very simple, single-function Google Suggest to the very complex and sophisticated Google Maps.&lt;br /&gt;&lt;br /&gt;At Adaptive Path, we?ve been doing our own work with Ajax over the last several months, and we?re realizing we?ve only scratched the surface of the rich interaction and responsiveness that Ajax applications can provide. Ajax is an important development for Web applications, and its importance is only going to grow. And because there are so many developers out there who already know how to use these technologies, we expect to see many more organizations following Google?s lead in reaping the competitive advantage Ajax provides.&lt;br /&gt;&lt;b&gt;Moving Forward&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The biggest challenges in creating Ajax applications are not technical. The core Ajax technologies are mature, stable, and well understood. Instead, the challenges are for the designers of these applications: to forget what we think we know about the limitations of the Web, and begin to imagine a wider, richer range of possibilities&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Should I consider AJAX?&lt;/b&gt;&lt;br /&gt;AJAX definitely has the buzz right now, but it might not be the right thing for you. AJAX is limited to the latest browsers, exposes browser compatibility issues, and requires new skill-sets for many. There is a good blog entry by Alex Bosworth on AJAX Mistakes which is a good read before you jump full force into AJAX.&lt;br /&gt;On the other hand you can achieve highly interactive rich web applications that are responsive and appear really fast. While it is debatable as to whether an AJAX based application is really faster, the user feels a sense of immediacy because they are given active feedback while data is exchanged in the background. If you are an early adopter and can handle the browser compatibility issues, and are willing to learn some more skills, then AJAX is for you. It may be prudent to start off AJAX-ifying a small portion or component of your application first. We all love technology, but just remember the purpose of AJAX is to enhance your user’s experience and not hinder it.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Does AJAX work with Java?&lt;/b&gt;&lt;br /&gt;Absolutely. Java is a great fit for AJAX! You can use Java Enterprise Edition servers to generate AJAX client pages and to serve incoming AJAX requests, manage server side state for AJAX clients, and connect AJAX clients to your enterprise resources. The JavaServer Faces component model is a great fit for defining and using AJAX components.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Won’t my server-side framework provide me with AJAX?&lt;/b&gt;&lt;br /&gt;You may be benefiting from AJAX already. Many existing Java based frameworks already have some level of AJAX interactions and new frameworks and component libraries are being developed to provide better AJAX support. I won’t list all the Java frameworks that use AJAX here, out of fear of missing someone, but you can find a good list at www.ajaxpatterns.org/Java_Ajax_Frameworks.&lt;br /&gt;If you have not chosen a framework yet it is recommended you consider using JavaServer Faces or a JavaServer Faces based framework. JavaServer Faces components can be created and used to abstract many of the details of generating JavaScript, AJAX interactions, and DHTML processing and thus enable simple AJAX used by JSF application developer and as plug-ins in JSF compatible IDE’s, such as Sun Java Studio Creator.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Where should I start?&lt;/b&gt;&lt;br /&gt;Assuming the framework you are using does not suffice your use cases and you would like to develop your own AJAX components or functionality I suggest you start with the article Asynchronous JavaScript Technology and XML (AJAX) With Java 2 Platform, Enterprise Edition.&lt;br /&gt;If you would like to see a very basic example that includes source code you can check out the tech tip Using AJAX with Java Technology. For a more complete list of AJAX resources the Blueprints AJAX home page.&lt;br /&gt;Next, I would recommend spending some time investigating AJAX libraries and frameworks. If you choose to write your own AJAX clients-side script you are much better off not re-inventing the wheel.&lt;br /&gt;AJAX in Action by Dave Crane and Eric Pascarello with Darren James is good resource. This book is helpful for the Java developer in that in contains an appendix for learning JavaScript for the Java developer.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Did Adaptive Path invent Ajax? Did Google? Did Adaptive Path help build Google?s Ajax applications?&lt;/b&gt;&lt;br /&gt;Neither Adaptive Path nor Google invented Ajax. Google?s recent products are simply the highest-profile examples of Ajax applications. Adaptive Path was not involved in the development of Google?s Ajax applications, but we have been doing Ajax work for some of our other clients.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Is it possible to set session variables from javascript?&lt;/b&gt;&lt;br /&gt;It’s not possible to set any session variables directly from javascript as it is purely a client side technology. You can use AJAX though to asyncronously…&lt;br /&gt;&lt;br /&gt;Cannot parse XML generated by JSP I am generating an XML using JSP, when i run the JSP in IE it shows the XML as per DOM, but when i try to parse it using Javascript , the command xmldoc.documentElement…&lt;br /&gt;&lt;br /&gt;This is working code I am using, it might help you. if (!isIE) xmldoc = req.responseXML; else { //IE does not take the responseXML as…&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What do I need to know to create my own AJAX functionality?&lt;/b&gt;&lt;br /&gt;If you plan not to reuse and existing AJAX component here are some of the things you will need to know.&lt;br /&gt;Plan to learn Dynamic HTML (DHTML), the technology that is the foundation for AJAX. DHTML enables browser-base real time interaction between a user and a web page. DHTML is the combination of JavaScript, the Document Object Model (DOM) and Cascading Style Sheets (CSS).&lt;br /&gt;* JavaScript – JavaScript is a loosely typed object based scripting language supported by all major browsers and essential for AJAX interactions. JavaScript in a page is called when an event in a page occurs such as a page load, a mouse click, or a key press in a form element.&lt;br /&gt;* DOM – An API for accessing and manipulating structured documents. In most cases DOM represent the structure of XML and HTML documents.&lt;br /&gt;* CSS – Allows you to define the presentation of a page such as fonts, colors, sizes, and positioning. CSS allow for a clear separation of the presentation from the content and may be changed programmatically by JavaScript.&lt;br /&gt;Understanding the basic request/response nature of HTTP is also important. Many subtle bugs can result if you ignore the differences between the GET and OIst methods when configuring an XMLHttpRequest and HTTP response codes when processing callbacks.&lt;br /&gt;JavaScript is the client-side glue, in a sense. JavaScript is used to create the XMLHttpRequest Object and trigger the asynchronous call. JavaScript is used to parse the returned content. JavaScript is used to analyze the returned data and process returned messages. JavaScript is used to inject the new content into the HTML using the DOM API and to modify the CSS.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Do I really need to learn JavaScript?&lt;/b&gt;&lt;br /&gt;Basically yes if you plan to develop new AJAX functionality for your web application.&lt;br /&gt;On the other hand, JSF components and component libraries can abstract the details of JavaScript, DOM and CSS. These components can generate the necessary artifacts to make AJAX interactions possible. Visual tools such as Java Studio Creator may also use AJAX enabled JSF components to create applications, shielding the tool developer from many of the details of&lt;br /&gt;&lt;br /&gt;AJAX. If you plan to develop your own JSF components or wire the events of components together in a tool it is important that you have a basic understanding of JavaScript. There are client-side JavaScript libraries (discussed below) that you can call from your in page JavaScript that abstract browser differences. Object Hierarchy and Inheritance in JavaScript is a great resource for a Java developer to learn about JavaScript objects.&lt;br /&gt;&lt;br /&gt;Do Ajax applications always deliver a better experience than traditional web applications?&lt;br /&gt;Not necessarily. Ajax gives interaction designers more flexibility. However, the more power we have, the more caution we must use in exercising it. We must be careful to use Ajax to enhance the user experience of our applications, not degrade it.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What JavaScript libraries and frameworks are available?&lt;/b&gt;&lt;br /&gt;There are many libraries/frameworks out there (and many more emerging) that will help abstract such things as all the nasty browser differences. Three good libraries are The Dojo Toolkit, Prototype, and DWR.&lt;br /&gt;&lt;br /&gt;* The Dojo Toolkit contains APIs and widgets to support the development of rich web applications. Dojo contains an intelligent packaging system, UI effects, drag and drop APIs, widget APIs, event abstraction, client storage APIs, and AJAX interaction APIs. Dojo solves common usability issues such as support for dealing with the navigation such as the ability to detect the browser back button, the ability to support changes to the URL in the URL bar for bookmarking, and the ability to gracefully degrade when AJAX/JavaScript is not fully support on the client. Dojo is the Swiss Army Knife of JavaScript libraries. It provides the widest range of options in a single library and it does a very good job supporting new and older browsers.&lt;br /&gt;* Prototype focuses on AJAX interactions including a JavaScript AJAX object that contains a few objects to do basic tasks such as make a request, update a portion of a document, insert content into a document, and update a portion of a document periodically. Prototype JavaScript library contains a set of JavaScript objects for representing AJAX requests and contains utility functions for accessing in page components and DOM manipulations. Script.aculo.us and Rico are built on top of Prototype and provide UI effects, support for drag and drop, and include common JavaScript centric widgets. If you are just looking to support AJAX interactions and a few basic tasks Prototype is great. If you are looking for UI effects Rico and Script.aculo.us are good options.&lt;br /&gt;* Yahoo UI Library is a utility library and set of widgets using the APIs to support rich clients. The utility library includes support for cross-browser AJAX interactions, animation, DOM scriptging support, drag and drop, and cross browser event support. The Yahoo UI Library is well documnented and contains many examples.&lt;br /&gt;* DWR (Dynamic Web Remoting) is a client-side and server-side framework that focuses on allowing a developer to do RPC calls from client-side JavaScript to plain old Java objects in a Java Enterprise Edition web container. On the server side DWR uses a Servlet to interact with the Java objects and returns object representations of the Java objects or XML documents. DWR will be easy to get up and running and plays well with other Java technologies. If you are looking for a client-side and server-side framework that integrates well use DWR.&lt;br /&gt;* Google Web Toolkit (GWT) is client/server framework provided by Google that allows a developer to write an AJAX application in pure Java. The GWT takes care of the details of generating all the client-side code using a Java-to-JavaScript compiler. One of the key benefits of the GWT Software Developer Kit (SDK) is that it allows you to debug your applications in what is known as GWT hosted mode using an embedded browser (IE on Windows and Mozilla/Gecko on Linux) that is tied to the toolkit. In GWT hosted mode you setup through the code and debug it as it is running on both the client and server. The GWT contains a default set of widgets and widget containers. An application is built by coding a set of widgets and containers together much like would be done in a Swing application. The GWT Software Developer Kit (SDK) is limited to Linux and Windows XP/2000 though the web applications it generates are compatible with the latest generation of the mainstream browsers.&lt;br /&gt;&lt;br /&gt;There are many new and emerging libraries for JavaScript and this list only reviews some of the more common libraries. When making a choice choose the library which suites your needs the best. While it might be better to choose one, there is nothing stopping you from using more than one framework. For a more extensive list of client-side frameworks see: Survey of AJAX/JavaScript Libraries.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is the difference between proxied and proxyless calls?&lt;/b&gt;&lt;br /&gt;Proxied calls are made through stub objects that mimic your PHP classes on the JavaScript side. E.g., the helloworld class from the Hello World example.&lt;br /&gt;Proxyless calls are made using utility javascript functions like HTML_AJAX.replace() and HTML_AJAX.append().&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Should I use XML or text, JavaScript, or HTML as a return type?&lt;/b&gt;&lt;br /&gt;It depends. Clearly the ‘X’ in AJAX stands for XML, but several AJAX proponents are quick to point out that nothing in AJAX, per se, precludes using other types of payload, such as, JavaScript, HTML, or plain text.&lt;br /&gt;&lt;br /&gt;* XML – Web Services and AJAX seem made for one another. You can use client-side API’s for downloading and parsing the XML content from RESTful Web Services. (However be mindful with some SOAP based Web Services architectures the payloads can get quite large and complex, and therefore may be inappropriate with AJAX techniqes.)&lt;br /&gt;* Plain Text – In this case server-generated text may be injected into a document or evaluated by client-side logic.&lt;br /&gt;* JavaScript – This is an extension to the plain text case with the exception that a server-side component passes a fragment of JavaScript including JavaScript object declarations. Using the JavaScript eval() function you can then create the objects on the client. JavaScript Object Notation (JSON), which is a JavaScript object based data exchange specification, relies on this technique.&lt;br /&gt;* HTML – Injecting server-generated HTML fragments directly into a document is generally a very effective AJAX technique. However, it can be complicated keeping the server-side component in sync with what is displayed on the client.&lt;br /&gt;&lt;br /&gt;Mashup is a popular term for creating a completely new web application by combining the content from disparate Web Services and other online API’s. A good example of a mashup is housingmaps.com which graphically combines housing want-ads from craiglist.org and maps from maps.google.com.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Are there Usability Issues with AJAX?&lt;/b&gt;&lt;br /&gt;The nature of updating a page dynamically using data retrieved via AJAX interactions and DHTML may result in drastically changing the appearance and state of a page. A user might choose to use the browser’s back or forward buttons, bookmark a page, copy the URL from the URL bar and share it with a friend via an email or chat client, or print a page at any given time. When designing an AJAX based application you need to consider what the expected behavior would be in the case of navigation, bookmarking, printing, and browser support as described below.&lt;br /&gt;&lt;br /&gt;* Navigation – What would be the expected behavior of the back, forward, refresh, and bookmark browser buttons in your application design. While you could implement history manipulation manually it may be easer to use a JavaScript frameworks such as Dojo that provides API’s history manipulation and navigation control.&lt;br /&gt;* Bookmarking and URL sharing – Many users want to bookmark or cut and paste the URL from the browser bar. Dojo provides client-side for bookmarking and URL manipulation.&lt;br /&gt;* Printing – In some cases printing dynamically rendered pages can be problematic.&lt;br /&gt;Other considerations as a developer when using AJAX are:&lt;br /&gt;* Browser Support – Not all AJAX/DHTML features are supported on all browsers or all versions of a browser. See quirksmode.org for a list of browser support and possible workarounds.&lt;br /&gt;* JavaScript disabled – You should also consider what happens if the user disables JavaScript. Additionally, there are several legitimate reasons why JavaScript and CSS support may be unavailable on a user’s web browser.&lt;br /&gt;* Latency – Keep in mind latency in your design. A running application will be much more responsive than when it is deployed.&lt;br /&gt;Latency problems: myth or reality?&lt;br /&gt;* Accessibility – Guaranteeing your site is accessible to people with disabilities is not only a noble goal, it is also requited by law in many markets. Some marvelous enabling technology is available to help people use the Web in spite of disabilities including visual, auditory, physical, speech, cognitive, and neurological disabilities. With a little forethought, and comprehension of some well documented best practices, you can assure that your application is compatible with that enabling technology.&lt;br /&gt;Degradability is the term used to describe techniques used by web applications to adapt to the wide range of web browser capabilities. Many AJAX libraries have automatic degradability built in. But if you are coding your own custom AJAX functionality, simply taking some care to follow the best practices promoted by standards bodies like the World Wide Web Consortium (W3C), and grass root movements like the Web Standards community and many others, your application can run usefully on browsers that are incapable of AJAX behaviors. Granted, your application may loose some of the “wow factor” on these less capable browsers, but your application will still be usable.&lt;br /&gt;Remember to not design with AJAX just for the sake of coolness. The reason you built your application is so people will use it. And people will not use your application if your application is not compatible with their web browser.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Are there any frameworks available to help speedup development with AJAX?&lt;/b&gt;&lt;br /&gt;There are several browser-side frameworks available, each with their own uniqueness…&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Is Adaptive Path selling Ajax components or trademarking the name? Where can I download it?&lt;/b&gt;&lt;br /&gt;Ajax isn?t something you can download. It?s an approach ? a way of thinking about the architecture of web applications using certain technologies. Neither the Ajax name nor the approach are proprietary to Adaptive Path.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Should I use an HTTP GET or POST for my AJAX calls?&lt;/b&gt;&lt;br /&gt;AJAX requests should use an HTTP GET request when retrieving data where the data will not change for a given request URL. An HTTP POST should be used when state is updated on the server. This is in line with HTTP idempotency recommendations and is highly recommended for a consistent web application architecture.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How do I debug JavaScript?&lt;/b&gt;&lt;br /&gt;There are not that many tools out there that will support both client-side and server-side debugging. I am certain this will change as AJAX applications proliferate. I currently do my client-side and server-side debugging separately. Below is some information on the client-side debuggers on some of the commonly used browsers.&lt;br /&gt;&lt;br /&gt;* Firefox/Mozilla/Netscape – Have a built in debugger Venkman which can be helpful but there is a Firefox add on known as FireBug which provides all the information and AJAX developer would ever need including the ability to inspect the browser DOM, console access to the JavaScript runtime in the browser, and the ability to see the HTTP requests and responses (including those made by an XMLHttpRequest). I tend to develop my applications initially on Firefox using Firebug then venture out to the other browsers.&lt;br /&gt;* Safari – Has a debugger which needs to be enabled. See the Safari FAQ for details.&lt;br /&gt;* Internet Explorer – There is MSDN Documentation on debugging JavaScript. A developer toolbar for Internet Explorer may also be helpful.&lt;br /&gt;&lt;br /&gt;While debuggers help a common technique knowing as “Alert Debugging” may be used. In this case you place “alert()” function calls inline much like you would a System.out.println. While a little primitive it works for most basic cases. Some frameworks such as Dojo provide APIs for tracking debug statements.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How do I provide internationalized AJAX interactions?&lt;/b&gt;&lt;br /&gt;Just because you are using XML does not mean you can properly send and receive localized content using AJAX requests. To provide internationalized AJAX components you need to do the following:&lt;br /&gt;&lt;br /&gt;* Set the charset of the page to an encoding that is supported by your target languages. I tend to use UTF-8 because it covers the most languages. The following meta declaration in a HTML/JSP page will set the content type:&lt;br /&gt;&lt;br /&gt;* In the page JavaScript make sure to encode any parameters sent to the server. JavaScript provides the escape() function which returns Unicode escape strings in which localized text will appear in hexadecimal format. For more details on JavaScript encoding see Comparing escape(), encodeURI(), and encodeURIComponent().&lt;br /&gt;* On the server-side component set the character encoding using the HttpServletRequest.setCharacterEncoding() method. Before you access the localized parameter using the HttpServletRequest.getParameter() call. In the case of UTF this would be request.setCharactherEncoding(“UTF-8″);.&lt;br /&gt;A server-side component returning AJAX responses needs to set the encoding of the response to the same encoding used in the page.&lt;br /&gt;response.setContentType(“text/xml;charset=;UTF-8″);&lt;br /&gt;response.getWriter().write(” invalid “);&lt;br /&gt;&lt;br /&gt;For more information on using AJAX with Java Enterprise Edition technologies see AJAX and Internationalization and for developing multi-lingual applications see Developing Multilingual Web Applications Using JavaServer Pages Technology.&lt;br /&gt;&lt;br /&gt;Some of the Google examples you cite don?t use XML at all. Do I have to use XML and/or XSLT in an Ajax application?&lt;br /&gt;No. XML is the most fully-developed means of getting data in and out of an Ajax client, but there?s no reason you couldn?t accomplish the same effects using a technology like JavaScript Object Notation or any similar means of structuring data for interchange.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Are Ajax applications easier to develop than traditional web applications?&lt;/b&gt;&lt;br /&gt;Not necessarily. Ajax applications inevitably involve running complex JavaScript code on the client. Making that complex code efficient and bug-free is not a task to be taken lightly, and better development tools and frameworks will be needed to help us meet that challenge.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;When do I use a synchronous versus a asynchronous request?&lt;/b&gt;&lt;br /&gt;Good question. They don’t call it AJAX for nothing! A synchronous request would block in page event processing and I don’t see many use cases where a synchronous request is preferable.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How do I handle concurrent AJAX requests?&lt;/b&gt;&lt;br /&gt;With JavaScript you can have more than one AJAX request processing at a single time. In order to insure the proper post processing of code it is recommended that you use JavaScript Closures. The example below shows an XMLHttpRequest object abstracted by a JavaScript object called AJAXInteraction. As arguments you pass in the URL to call and the function to call when the processing is done.&lt;br /&gt;function AJAXInteraction(url, callback) {&lt;br /&gt;&lt;br /&gt;var req = init();&lt;br /&gt;req.onreadystatechange = processRequest;&lt;br /&gt;&lt;br /&gt;function init() {&lt;br /&gt;if (window.XMLHttpRequest) {&lt;br /&gt;return new XMLHttpRequest();&lt;br /&gt;} else if (window.ActiveXObject) {&lt;br /&gt;return new ActiveXObject(“Microsoft.XMLHTTP”);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;function processRequest () {&lt;br /&gt;if (req.readyState == 4) {&lt;br /&gt;if (req.status == 200) {&lt;br /&gt;if (callback) callback(req.responseXML);&lt;br /&gt;}&amp;nbsp;}&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;this.doGet = function() {&lt;br /&gt;req.open(“GET”, url, true);&lt;br /&gt;req.send(null);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;this.doPost = function(body) {&lt;br /&gt;req.open(“POST”, url, true);&lt;br /&gt;req.setRequestHeader(“Content-Type”, “&lt;br /&gt;application/x-www-form-urlencoded”);&lt;br /&gt;req.send(body);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function makeRequest() {&lt;br /&gt;var ai = new AJAXInteraction(“processme”,&lt;br /&gt;function() { alert(“Doing Post Process”);});&lt;br /&gt;ai.doGet();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The function makeRequest() in the example above creates an AJAXInteraction with a URL to of “processme” and an inline function that will show an alert dialog with the message “Doing Post Process”. When ai.doGet() is called the AJAX interaction is initiated and when server-side component mapped to the URL “processme” returns a document which is passed to the callback function that was specified when the AJAXInteraction was created.&lt;br /&gt;Using this closures insures that the proper callback function associated with a specific AJAX interaction is called. Caution should still be taken when creating multiple closure objects in that make XmlHttpRequests as to there is a limited number of sockets that are used to make requests at any given time. Because there are limited number of requests that can be made concurrently. Internet Explorer for example only allows for two concurrent AJAX requests at any given time. Other browsers may allow more but it is generally between three and five requests. You may choose to use pool of AJAXInteraction objects.&lt;br /&gt;One thing to note when making multiple AJAX calls from the client is that the calls are not guaranteed to return in any given order. Having closures within the callback of a closure object can be used to ensure dependencies are processed correctly.&lt;br /&gt;There is a discussion titled Ajaxian Fire and Forget Pattern that is helpful.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What do I do on the server to interact with an AJAX client?&lt;/b&gt;&lt;br /&gt;The “Content-Type” header needs to be set to”text/xml”. In servlets this may be done using the HttpServletResponse.setContentType()should be set to “text/xml” when the return type is XML. Many XMLHttpRequest implementations will result in an error if the “Content-Type” header is set The code below shows how to set the “Content-Type”.&lt;br /&gt;&lt;br /&gt;response.setContentType(“text/xml”);&lt;br /&gt;response.getWriter().write(“invalid”);&lt;br /&gt;&lt;br /&gt;You may also want to set whether or not to set the caches header for cases such as autocomplete where you may want to notify proxy servers/and browsers not to cache the results.&lt;br /&gt;&lt;br /&gt;response.setContentType(“text/xml”);&lt;br /&gt;response.setHeader(“Cache-Control”, “no-cache”);&lt;br /&gt;response.getWriter().write(“invalid”);&lt;br /&gt;&lt;br /&gt;Note to the developer: Internet Explorer will automatically use a cached result of any AJAX response from a HTTP GET if this header is not set which can make things difficult for a developer. During development mode you may want set this header. Where do I store state with an AJAX client&lt;br /&gt;&lt;br /&gt;As with other browser based web applications you have a few options which include:&lt;br /&gt;* On the client in cookies – The size is limited (generally around 4KB X 20 cookies per domain so a total of 80KB) and the content may not be secure unless encrypted which is difficult but not impossible using JavaScript.&lt;br /&gt;* On the client in the page – This can be done securely but can be problematic and difficult to work with. See my blog entry on Storing State on the Client for more details on this topic.&lt;br /&gt;* On the client file system – This can be done if the client grants access to the browser to write to the local file system. Depending on your uses cases this may be necessary but caution is advised.&lt;br /&gt;* On the Server – This is closer to the traditional model where the client view is of the state on the server. Keeping the data in sync can be a bit problematic and thus we have a solution Refreshing Data on this. As more information processing and control moves to the client where state is stored will need to be re-evaluated.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Whats with the -alpha in the install instructions?&lt;/b&gt;&lt;br /&gt;HTML_AJAX hasn’t had a stable release yet and the pear installer doesn’t install non stable packages by default unless you specify a version.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How do I submit a form or a part of a form without a page refresh?&lt;/b&gt;&lt;br /&gt;When creating a form make sure that the “form” element “onSubmit” attribute is set to a JavaScript function that returns false.&lt;br /&gt;&lt;br /&gt;You can also submit data by associating a function with a form button in a similar way.&lt;br /&gt;&lt;br /&gt;Note that the form “onSubmit” attribute is still set. If the user hits the enter key in the text field the form will be submitted so you still need to handle that case.&lt;br /&gt;When updating the page it is recommend you wait to make sure that the AJAX update of the form data was successful before updating the data in the page. Otherwise, the data may not properly update and the user may not know. I like to provide an informative message when doing a partial update and upon a successful AJAX interaction I will then update the page.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How do I test my AJAX code?&lt;/b&gt;&lt;br /&gt;There is a port of JUnit for client-side JavaScript called JsUnit&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What exactly is the W3C DOM?&lt;/b&gt;&lt;br /&gt;The W3C Document Object Model (DOM) is defined by the W3C as the following: The Document Object Model is a platform- and language-neutral interface…&lt;br /&gt;&lt;br /&gt;&lt;b&gt;When will HTML_AJAX have a stable release?&lt;/b&gt;&lt;br /&gt;Once all the major features are complete and the API has been tested, the roadmap gives an idea of whats left to be done.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What parts of the HTML_AJAX API are stable?&lt;/b&gt;&lt;br /&gt;We don’t have a list right now, but most of the API is stable as of 0.3.0. There should be no major changes at this point, though there will be lots of new additions.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What Browsers does HTML_AJAX work with?&lt;/b&gt;&lt;br /&gt;As of 0.3.0, all the examples that ship with HTML_AJAX have been verified to work with&lt;br /&gt;* Firefox 1.0+&lt;br /&gt;* Internet Explorer 5.5+ (5.0 should work but it hasn’t been tested)&lt;br /&gt;Most things work with&lt;br /&gt;* Safari 2+&lt;br /&gt;* Opera 8.5+&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Is the server or the client in control?&lt;/b&gt;&lt;br /&gt;It depends. With AJAX the answer is more in between. Control can be more centralized in a server-side component or as a mix of client-side and server-side controllers.&lt;br /&gt;&lt;br /&gt;* Centralized server-side controller – When having a more centralized controller the key is to make sure the data in client-side page is in sync with that of the server. Some applications may keep all the state on the server and push all updates to client DOM via a simple JavaScript controller.&lt;br /&gt;* Client and server-side controllers – This architecture would use JavaScript to do all presentation related control, event processing, page manipulation, and rendering of model data on the client. The server-side would be responsible for things such as business logic and pushing updated model data to the client. In this case the server would not have intimate knowledge of the presentation short of the initial page that would be sent to the client page request.&lt;br /&gt;&lt;br /&gt;There are some use cases where an entire AJAX application can be written in a single page. Keep in mind if you choose this type of architecture that navigation and bookmarking should be considered.&lt;br /&gt;Both methods are viable depending on what you are trying to accomplish. I tend to prefer spreading the control across the client and server.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Is Ajax just another name for XMLHttpRequest?&lt;/b&gt;&lt;br /&gt;No. XMLHttpRequest is only part of the Ajax equation. XMLHttpRequest is the technical component that makes the asynchronous server communication possible; Ajax is our name for the overall approach described in the article, which relies not only on XMLHttpRequest, but on CSS, DOM, and other technologies.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How do I abort the current XMLHttpRequest?&lt;/b&gt;&lt;br /&gt;Just call the abort() method on the request.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is the minimum version of PHP that needs to be running in order to use HTML_AJAX?&lt;/b&gt;&lt;br /&gt;The oldest PHP version i’ve fully tested HTML_AJAX is 4.3.11, but it should run on 4.2.0 without any problems. (Testing reports from PHP versions older then 4.3.11 would be appreciated.)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Why does HTML_AJAX hang on some server installs?&lt;/b&gt;&lt;br /&gt;If you run into an HTML_AJAX problem only on some servers, chances are your running into a problem with output compression. If the output compression is handled in the PHP config we detect that and do the right thing, but if its done from an apache extension we have no way of knowing its going to compress the body. Some times setting HTML_AJAX::sendContentLength to false fixes the problem, but in other cases you’ll need to disabled the extension for the AJAX pages.&lt;br /&gt;I’ve also seen problems caused by debugging extensions like XDebug, disabling the extension on the server page usually fixes that. Questions dealing with Using HTML_AJAX, and general JavaScript development&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How do I get the XMLHttpRequest object?&lt;/b&gt;&lt;br /&gt;Depending upon the browser… if (window.ActiveXObject) { // Internet Explorer http_request = new ActiveXObject(“Microsoft.XMLHTTP”); } else if…&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Are there any security issues with AJAX?&lt;/b&gt;&lt;br /&gt;JavaScript is in plain view to the user with by selecting view source of the page. JavaScript can not access the local filesystem without the user’s permission. An AJAX interaction can only be made with the servers-side component from which the page was loaded. A proxy pattern could be used for AJAX interactions with external services.&lt;br /&gt;You need to be careful not to expose your application model in such as way that your server-side components are at risk if a nefarious user to reverse engineer your application. As with any other web application, consider using HTTPS to secure the connection when confidential information is being exchanged.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What about applets and plugins ?&lt;/b&gt;&lt;br /&gt;Don’t be too quick to dump your plugin or applet based portions of your application. While AJAX and DHTML can do drag and drop and other advanced user interfaces there still limitations especially when it comes to browser support. Plugins and applets have been around for a while and have been able to make AJAX like requests for years. Applets provide a great set of UI components and APIs that provide developers literally anything.&lt;br /&gt;Many people disregard applets or plugins because there is a startup time to initialize the plugin and there is no guarantee that the needed version of a plugin of JVM is installed. Plugins and applets may not be as capable of manipulating the page DOM. If you are in a uniform environment or can depend on a specific JVM or plugin version being available (such as in a corporate environment) a plugin or applet solution is great.&lt;br /&gt;One thing to consider is a mix of AJAX and applets or plugins. Flickr uses a combination of AJAX interactions/DHTML for labeling pictures and user interaction and a plugin for manipulating photos and photo sets to provide a great user experience. If you design your server-side components well they can talk to both types of clients.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Why did you feel the need to give this a name?&lt;/b&gt;&lt;br /&gt;I needed something shorter than ?Asynchronous JavaScript+CSS+DOM+XMLHttpRequest? to use when discussing this approach with clients.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Is AJAX code cross browser compatible?&lt;/b&gt;&lt;br /&gt;Not totally. Most browsers offer a native XMLHttpRequest JavaScript object, while another one (Internet Explorer) require you to get it as an ActiveX object….&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Techniques for asynchronous server communication have been around for years. What makes Ajax a ?new? approach?&lt;/b&gt;&lt;br /&gt;What?s new is the prominent use of these techniques in real-world applications to change the fundamental interaction model of the Web. Ajax is taking hold now because these technologies and the industry?s understanding of how to deploy them most effectively have taken time to develop.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Is Ajax a technology platform or is it an architectural style?&lt;/b&gt;&lt;br /&gt;It?s both. Ajax is a set of technologies being used together in a particular way.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How do I handle the back and forward buttons?&lt;/b&gt;&lt;br /&gt;While you could go out and create a custom solution that tracks the current state on your application I recommend you leave this to the experts. Dojo addresses the navigation in a browser neutral way as can be seen in the JavaScript example below.&lt;br /&gt;function updateOnServer(oldId, oldValue,&lt;br /&gt;itemId, itemValue) {&lt;br /&gt;var bindArgs = {&lt;br /&gt;url: “faces/ajax-dlabel-update”,&lt;br /&gt;method: “post”,&lt;br /&gt;content: {“component-id”: itemId, “component-value”:&lt;br /&gt;itemValue},&lt;br /&gt;mimetype: “text/xml”,&lt;br /&gt;load: function(type, data) {&lt;br /&gt;processUpdateResponse(data);&lt;br /&gt;},&lt;br /&gt;backButton: function() {&lt;br /&gt;alert(“old itemid was ” + oldId);&lt;br /&gt;},&lt;br /&gt;forwardButton: function(){&lt;br /&gt;alert(“forward we must go!”);&lt;br /&gt;}&lt;br /&gt;};&lt;br /&gt;dojo.io.bind(bindArgs);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The example above will update a value on the server using dojo.io.bind() with a function as a property that is responsible for dealing with the browser back button event. As a developer you are capable of restoring the value to the oldValue or taking any other action that you see fit. The underlying details of how the how the browser button event are detected are hidden from the developer by Dojo.&lt;br /&gt;AJAX: How to Handle Bookmarks and Back Buttons details this problem and provides a JavaScript library Really Simple History framework (RSH) that focuses just on the back and forward issue.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How does HTML_AJAX compare with the XAJAX project at Sourceforge?&lt;/b&gt;&lt;br /&gt;XAJAX uses XML as a transport for data between the webpage and server, and you don’t write your own javascript data handlers to manipulate the data received from the server. Instead you use a php class and built in javascript methods, a combination that works very similiar to the HTML_AJAX_Action class and haSerializer combo. XAJAX is designed for simplicity and ease of use.&lt;br /&gt;HTML_AJAX allows for multiple transmission types for your ajax data – such as urlencoding, json, phpserialized, plain text, with others planned, and has a system you can use to write your own serializers to meet your specific needs. HTML_AJAX has a class to help generate javascript (HTML_AJAX_Helper) similiar to ruby on rail’s javascript helper (although it isn’t complete), and an action system similiar to XAJAX’s “action pump” that allows you to avoid writing javascript data handlers if you desire.&lt;br /&gt;But it also has the ability to write your own data handling routines, automatically register classes and methods using a server “proxy” script, do different types of callbacks including grabbing remote urls, choose between sync and async requests, has iframe xmlhttprequest emulation fallback capabilities for users with old browsers or disabled activeX, and is in active development with more features planned (see the Road Map for details)&lt;br /&gt;HTML_AJAX has additional features such as client pooling and priority queues for more advanced users, and even a javascript utility class. Although you can use HTML_AJAX the same way you use XAJAX, the additional features make it more robust, extensible and flexible. And it is a pear package, you can use the pear installer to both install and keep it up to date.&lt;br /&gt;If you’re asking which is “better” – as with most php scripts it’s a matter of taste and need. Do you need a quick, simple ajax solution? Or do you want something that’s flexible, extensible, and looking to incorporate even more great features? It depends on the project, you as a writer, and your future plans.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What browsers support AJAX?&lt;/b&gt;&lt;br /&gt;Internet Explorer 5.0 and up, Opera 7.6 and up, Netscape 7.1 and up, Firefox 1.0 and up, Safari 1.2 and up, among others.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How do I send an image using AJAX?&lt;/b&gt;&lt;br /&gt;While it may appear that images are being sent when using AJAX with an application like Google Maps what is really happening is that the URLs of images are being send as the response of an AJAX request and those URLs are being set using DHTML.&lt;br /&gt;In this example an XML document is returned from an AJAX interaction and the category bar is populated.&lt;br /&gt;&lt;br /&gt;1&lt;br /&gt;Books&lt;br /&gt;Fun to read&lt;br /&gt;books_icon.gif&lt;br /&gt;&lt;br /&gt;2&lt;br /&gt;Electronics&lt;br /&gt;Must have gadgets&lt;br /&gt;electronics.gif&lt;br /&gt;&lt;br /&gt;Notice that the image-url element contains the location of the URL for the image representing a category. The callback method of an AJAX interaction will parse the response XML document and call the addCategory function for each category included in the response XML document. The addCategory function looks up a table row element “categoryTable” in body of the page and adds a row to the element which contains the image.&lt;br /&gt;function addCategory(id, name, imageSrc) {&lt;br /&gt;&lt;br /&gt;var categoryTable = document.getElementById(“categoryTable”);&lt;br /&gt;var row = document.createElement(“tr”);&lt;br /&gt;var catCell = document.createElement(“td”);&lt;br /&gt;var img = document.createElement(“img”);&lt;br /&gt;img.src = (“images\\” + imageSrc);&lt;br /&gt;var link = document.createElement(“a”);&lt;br /&gt;link.className =”category”;&lt;br /&gt;link.appendChild(document.createTextNode(name));&lt;br /&gt;link.setAttribute(“onclick”, “catalog?command=category&amp;amp;catid=” + id);&lt;br /&gt;catCell.appendChild(img);&lt;br /&gt;catCell.appendChild(link);&lt;br /&gt;row.appendChild(catCell);&lt;br /&gt;categoryTable.appendChild(row);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;…&lt;br /&gt;Body Here&lt;br /&gt;&lt;br /&gt;Note that the source of the image is set to the image source. The image is loaded by a subsequent HTTP request for the image at the URL “images/books_icon.gif” or “images/electronic_icon.gif” that occurs when the img element is added to the categoryTable.&lt;br /&gt;&lt;br /&gt;Will HTML_AJAX integrate with other Javascript AJAX libraries such as scriptaculous ? How would this integration look like?&lt;br /&gt;HTML_AJAX doesn’t have specific plans to integrate with other JavaScript libraries. Part of this is because external dependencies make for a more complicated installation process. It might make sense to offer some optional dependencies on a library like scriptaculous automatically using its visual effects for the loading box or something, but there isn’t a lot to gain from making default visuals like that flashier since they are designed to be easily replaceable.&lt;br /&gt;&lt;br /&gt;Most integration would take place in higher level components. Its unclear whether higher level components like that should be part of HTML_AJAX delivered through PEAR or if they should just be supported by HTML_AJAX and made available from http://htmlajax.org or some other site. If your interested in building widgets or components based on HTML_AJAX please let me know.&lt;br /&gt;&lt;br /&gt;HTML_AJAX does however offer the ability to use its library loading mechanism with any JavaScript library. I use scriptaculous in conjunction with HTML_AJAX and I load both libraries through the server.&lt;br /&gt;&lt;br /&gt;To do this you just need to register the library with your server and load add its flag to your include line.&lt;br /&gt;&lt;br /&gt;server-&amp;gt;registerJSLibrary(‘scriptaculous’,&lt;br /&gt;array(‘prototype.js’,'scriptaculous.js’,'builder.js’,'effects.js’,'dragdrop.js’,'controls.js’,'slider.js’), ‘/pathto/scriptaculous/’);?&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;When should I use an Java applet instead of AJAX?&lt;/b&gt;&lt;br /&gt;Applets provide a rich experience on the client side and there are many things they can do that an AJAX application cannot do, such as custom data streaming, graphic manipulation, threading, and advanced GUIs. While DHTML with the use of AJAX has been able to push the boundaries on what you can do on the client, there are some things that it just cannot do. The reason AJAX is so popular is that it only requires functionality built into the browser (namely DHTML and AJAX capabilities). The user does not need to download and/or configure plugins. It is easy to incrementally update functionality and know that that functionality will readily available, and there are not any complicated deployment issues. That said, AJAX-based functionality does need to take browser differences into consideration. This is why we recommend using a JavaScript library such as Dojo which abstracts browser differences. So the “bottom line” is: If you are creating advanced UIs where you need more advanced features on the client where you want UI accuracy down to the pixel, to do complex computations on the client, use specialized networking techniques, and where you know that the applet plugin is available for your target audience, applets are the way to go. AJAX/DHTML works well for applications where you know the users are using the latest generation of browsers, where DHTML/AJAX “good enough” for you, and where your developers have JavaScript/DHTML/AJAX skills. Many amazing things can be done with AJAX/DHTML but there are limitations. AJAX and applets can be used together in the same UIs with AJAX providing the basic structure and applets providing more advanced functionality. The Java can communicate to JavaScript using the Live-Connect APIs. The question should not be should framed as do I use AJAX or applets, but rather which technology makes the best sense for what you are doing. AJAX and applets do not have to be mutually exclusive.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What kinds of applications is Ajax best suited for?&lt;/b&gt;&lt;br /&gt;We don?t know yet. Because this is a relatively new approach, our understanding of where Ajax can best be applied is still in its infancy. Sometimes the traditional web application model is the most appropriate solution to a problem.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Does this mean Adaptive Path is anti-Flash?&lt;/b&gt;&lt;br /&gt;Not at all. Macromedia is an Adaptive Path client, and we?ve long been supporters of Flash technology. As Ajax matures, we expect that sometimes Ajax will be the better solution to a particular problem, and sometimes Flash will be the better solution. We?re also interested in exploring ways the technologies can be mixed (as in the case of Flickr, which uses both).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Where can I find examples of AJAX?&lt;/b&gt;&lt;br /&gt;While components of AJAX have been around for some time (for instance, 1999 for XMLHttpRequest), it really didn’t become that popular until Google took…&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is the XMLHttpRequest object?&lt;/b&gt;&lt;br /&gt;It offers a non-blocking way for JavaScript to communicate back to the web server to update only part of the web page.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Does Ajax have significant accessibility or browser compatibility limitations? Do Ajax applications break the back button? Is Ajax compatible with REST? Are there security considerations with Ajax development? Can Ajax applications be made to work for users who have JavaScript turned off?&lt;/b&gt;&lt;br /&gt;The answer to all of these questions is ?maybe?. Many developers are already working on ways to address these concerns. We think there?s more work to be done to determine all the limitations of Ajax, and we expect the Ajax development community to uncover more issues like these along the way.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How do I access data from other domains to create a mashup with Java?&lt;/b&gt;&lt;br /&gt;From your JavaScript clients you can access data in other domains if the return data is provide in JSON format. In essence you can create a JavaScript client that runs operates using data from a different server. This technique is know as JSON with Padding or JSONP. There are questions as to whether this method is secure as you are retrieving data from outside your domain and allowing it to be excuted in the context of your domain. Not all data from third parties is accessible as JSON and in some cases you may want an extra level of protection. With Java you can provide a proxy to third party services using a web component such as a servlet. This proxy can manage the communication with a third party service and provide the data to your clients in a format of your choosing. You can also cache data at your proxy and reduce trips to service. For more on using a Java proxy to create mashups see The XmlHttpProxy Client for Java.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Does Java have support for Comet style server-side push?&lt;/b&gt;&lt;br /&gt;Current AJAX applications use polling to communicate changes data between the server and client. Some applications, such as chat applications, stock tickers, or score boards require more immediate notifications of updates to the client. Comet is an event based low latency server side push for AJAX applications. Comet communication keeps one of the two connections available to the browser open to continously communicate events from the server to the client. A Java based solution for Comet is being developed for Glassfish on top of the Grizzly HTTP connector. See Enabling Grizzly by Jean-Francois Arcand for more details.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How do I create a thread to do AJAX polling?&lt;/b&gt;&lt;br /&gt;JavaScript does not have threads. JavaScript functions are called when an event happens in a page such as the page is loaded, a mouse click, or a form element gains focus. You can create a timer using the setTimeout which takes a function name and time in milliseconds as arguments. You can then loop by calling the same function as can be seen in the JavaScript example below.&lt;br /&gt;&lt;br /&gt;function checkForMessage() {&lt;br /&gt;// start AJAX interaction with processCallback as the callback function&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// callback for the request&lt;br /&gt;function processCallback() {&lt;br /&gt;&lt;br /&gt;// do post processing&lt;br /&gt;setTimeout(“checkForMessage()”, 10000);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Notice that the checkForMessage will continue to loop indefinitely. You may want to vary the increment the interval based on activity in the page or your use cases. You may also choose to have logic that would break out of the loop based on some AJAX response processing condition.&lt;br /&gt;&lt;br /&gt;Is the XMLHttpRequest object part of a W3C standard?&lt;br /&gt;No. Or not yet. It is part of the DOM Level 3 Load and Save Specification proposal.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-7926872647642392328?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/7926872647642392328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2010/06/ajax-interview-questions-and-answers.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/7926872647642392328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/7926872647642392328'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2010/06/ajax-interview-questions-and-answers.html' title='AJAX Interview Questions and Answers'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-1990857071063455885</id><published>2010-06-18T17:42:00.000+05:30</published><updated>2010-06-18T17:42:11.065+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='interview questions'/><category scheme='http://www.blogger.com/atom/ns#' term='interview'/><category scheme='http://www.blogger.com/atom/ns#' term='answers'/><category scheme='http://www.blogger.com/atom/ns#' term='php interview questions and answers'/><category scheme='http://www.blogger.com/atom/ns#' term='html interview question and answers'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><title type='text'>Web Design HTML Interview Questions &amp; Answers</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Arial; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;em&gt;&lt;strong&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Web Design HTML Interview Questions &amp;amp; Answers&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/em&gt;&lt;br /&gt;1) Intrepret this statement: &lt;strong&gt;Michelle&lt;/strong&gt;&lt;br /&gt;a) It makes Michelle strong&lt;br /&gt;b) It highlights Michelle as being strong&lt;br /&gt;c) It will print out Michelle in bold font &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;2) Tables can be nested (table inside of another table).&lt;br /&gt;a) True &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;b) False&lt;br /&gt;&lt;br /&gt;3) Which is correct?&lt;br /&gt;a) &amp;lt;b&amp;gt;Click Here&amp;lt;b&amp;gt;&lt;br /&gt;b) &amp;lt;strong&amp;gt;Click Here&amp;lt;strong&amp;gt;&lt;br /&gt;c) &amp;lt;b&amp;gt;Click Here&amp;lt;/b&amp;gt; &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;d) &amp;lt;/strong&amp;gt;Click Here&amp;lt;/strong&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;br /&gt;4) Which of the following is a two sided tag?&lt;br /&gt;a) DT&lt;br /&gt;b) LI&lt;br /&gt;c) DD&lt;br /&gt;d) DL &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;5) The Browser applies the feature of a tag until it  encounters_____tag.&lt;br /&gt;a) Quit&lt;br /&gt;b) Closing &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;c) Exit&lt;br /&gt;d) Anti&lt;br /&gt;e) Deactivate&lt;br /&gt;&lt;br /&gt;6) _______are the HTML codes that control the apearance of the  document contents&lt;br /&gt;a) Tags &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;b) Codas&lt;br /&gt;c) Slashes&lt;br /&gt;d) Properties&lt;br /&gt;e) Code&lt;br /&gt;&lt;br /&gt;7) What are the genral syntax for inline image?&lt;br /&gt;a) src=img&lt;br /&gt;b) src=image&lt;br /&gt;c) img=file&lt;br /&gt;d) img src=file &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;e) image src=file&lt;br /&gt;&lt;br /&gt;8) An HTML_____takes text in one format and changes it to HTML code.&lt;br /&gt;a) Browser&lt;br /&gt;b) Editor&lt;br /&gt;c) Converter&lt;strong&gt; – correct answer&lt;/strong&gt;&lt;br /&gt;d) Processor&lt;br /&gt;e) Parser&lt;br /&gt;&lt;br /&gt;9) To create a link to an anchor, you use the______property in A tag.&lt;br /&gt;a) Name&lt;br /&gt;b) Tag&lt;br /&gt;c) Link&lt;br /&gt;d) Href &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;10) HTML Tags are case sensitive.&lt;br /&gt;a) True&lt;br /&gt;b) False&lt;strong&gt; – correct answer&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;11) Relative path make your hypertext links______.&lt;br /&gt;a) Portable &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;b) Discrete&lt;br /&gt;c) Uniform&lt;br /&gt;&lt;br /&gt;12) A_____structure starts with a general topic that includes link to  more specific topics.&lt;br /&gt;a) Hierarchical &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;b) Linear&lt;br /&gt;c) Mixed&lt;br /&gt;&lt;br /&gt;13) Which of the following path is supported by HTML?&lt;br /&gt;a) Ralative&lt;br /&gt;b) Defererenced&lt;br /&gt;c) Absolute and Relative &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;14) You cannot designate an inline image as a hypertext link.&lt;br /&gt;a) True&lt;br /&gt;b) False &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;15) Because each computer differs in terms of what fonts it can  display, each individual browser determines how text is to be displayed.&lt;br /&gt;a) True &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;b) False&lt;br /&gt;&lt;br /&gt;16) You do not have to connect to the internet to verify changes to a  Web page on your computer.&lt;br /&gt;a) True &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;b) False&lt;br /&gt;&lt;br /&gt;17) You can combine structures e.g, linear and hierarchical.&lt;br /&gt;a) True &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;b) False&lt;br /&gt;&lt;br /&gt;18) What is HTML stands for?&lt;br /&gt;a) Hypertext Mailing List&lt;br /&gt;b) Hypertext Mark Language&lt;br /&gt;c) Hypertext Markup Language &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;19) What is the tag for an inline frmae?&lt;br /&gt;a) Iframe&lt;strong&gt; – correct answer&lt;/strong&gt;&lt;br /&gt;b) Inframe&lt;br /&gt;c) frame&lt;br /&gt;d) inlineframe&lt;br /&gt;&lt;br /&gt;20) Within the MAP tag, you use the AREA tag to specify the areas of  the image that will act as a hotspot.&lt;br /&gt;a) True &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;b) False&lt;br /&gt;&lt;br /&gt;21) Can you create an e-mail form with auto responder using form  action method=mailto:youdomainname.com?&lt;br /&gt;a) Yes&lt;br /&gt;b) No &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;22) What is the most widely use e-mail form script?&lt;br /&gt;a) ASP&lt;br /&gt;b) PHP&lt;strong&gt; – correct answer&lt;/strong&gt;&lt;br /&gt;c) Perl CGI&lt;br /&gt;d) JSP&lt;br /&gt;&lt;br /&gt;23) There are_____color names recognized by all version of HTML.&lt;br /&gt;a) 6&lt;br /&gt;b) 8&lt;br /&gt;c) 256&lt;br /&gt;d) 16 -&lt;strong&gt; correct answer&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;24) Software programs, like your Web browser, use a mathemathical  approach to define color.&lt;br /&gt;a) True &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;b) False&lt;br /&gt;&lt;br /&gt;25) If you want to increase the font size by 2 relative to the  sorounding text, you enter +2 in the tag.&lt;br /&gt;a) True &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;b) False&lt;br /&gt;&lt;br /&gt;26) What operator makes converts 00110011 into 11001100?&lt;br /&gt;a) ~ &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;b) !&lt;br /&gt;c) &amp;amp;&lt;br /&gt;d) |&lt;br /&gt;&lt;br /&gt;27) The default statement of a switch is always executed.&lt;br /&gt;a) True&lt;br /&gt;b) False &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;28) H1 is the smallest header tag.&lt;br /&gt;a) True&lt;br /&gt;b) False &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;29) The page title is inside the____tag.&lt;br /&gt;a) Body&lt;br /&gt;b) Head&lt;strong&gt; – correct answer&lt;/strong&gt;&lt;br /&gt;c) Division&lt;br /&gt;d) Table&lt;br /&gt;&lt;br /&gt;30) _____refers to the way the GIF file is saved by the graphics  software.&lt;br /&gt;a) Dithering&lt;br /&gt;b) Interlacing &lt;strong&gt;- correct answer&lt;/strong&gt;&lt;br /&gt;c) Balancing&lt;/span&gt;&lt;b&gt;&lt;b&gt;&lt;/b&gt;&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;b&gt;&lt;/b&gt;&lt;/b&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-1990857071063455885?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/1990857071063455885/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2010/06/web-design-html-interview-questions.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/1990857071063455885'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/1990857071063455885'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2010/06/web-design-html-interview-questions.html' title='Web Design HTML Interview Questions &amp; Answers'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-2940970985425217855</id><published>2010-06-18T12:53:00.002+05:30</published><updated>2011-08-25T18:37:44.574+05:30</updated><title type='text'>PHP Interview Questions with Answers</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;a href="http://muruganasm.blogspot.com/2010/06/php-interview-questions-with-answers.html"&gt;PHP Interview Questions with Answers&lt;span id="goog_917496083"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-2940970985425217855?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/2940970985425217855/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2010/06/senthilmurugan-rajendran-php-interview.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/2940970985425217855'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/2940970985425217855'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2010/06/senthilmurugan-rajendran-php-interview.html' title='PHP Interview Questions with Answers'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-4689765542612561999</id><published>2010-06-18T12:04:00.000+05:30</published><updated>2010-06-18T12:22:01.839+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='interview questions'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql interview questions'/><category scheme='http://www.blogger.com/atom/ns#' term='interview'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='php interview questions and answers'/><title type='text'>PHP Interview Questions with Answers</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;&lt;b&gt;1) What is the difference between strstr &amp;amp; stristr?&lt;/b&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;For strstr, the syntax is: string strstr(string $string,string $str ); The function strstr will search $str in $string. If it finds the string means it will return string from where it finds the $str upto end of $string.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;For Example: $string = "http:// yahoomail.com"; $str="yahoomail";&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;The output is "yahoo.com". The main difference between strstr and stristr is of case sensitivity. The former consider the case difference and later ignore the case difference.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;&lt;b&gt;2) What is the difference between explode and split?&lt;/b&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;Split function splits string into array by regular expression. Explode splits a string into array by string.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;For Example:&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;explode(" and", "India and Pakistan and Srilanka");&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;split(" :", "India : Pakistan : Srilanka");&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;Both of these functions will return an array that contains India, Pakistan, and Srilanka.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;&lt;b&gt;3) How can you avoid execution time out error while fetching record from MySQL?&lt;/b&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;set_time_limit -- Limits the maximum execution time&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;For Example:&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;set_time_limit(0);&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;If you set to 0 you say that there is not limit.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;b&gt;4) Write a SQL query that displays the difference between the highest and lowest salaries of a database table "employees". Label the column as DIFFERENCE.&lt;/b&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;Select max(sal)-min(sal) as Difference from employees;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;&lt;b&gt;5) What is the difference between require() and include()?&lt;/b&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;Both of these constructs includes and evaluates the specific file. The two functions are identical in every way except how they handle failure. If filepath not found, require() terminates the program and gives fatal error, but include() does not terminate the program; It gives warning message and continues to program.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;include() produces a Warning while require() results in a Fatal Error if the filepath is not correct.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;b&gt;6) What is the difference between echo and print?&lt;/b&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;Main difference between echo() and print() is that echo is just an statement not a function and doesn't return's value or it just prints a value whereas print() is an function which prints a value and also it returns value.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;We cannot pass arguments to echo since it is just a statement whereas print is a function and we can pass arguments to it and it returns true or false. print can be used as part of a more complex expression whereas echo cannot. echo is marginally faster since it doesn't set a return value.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;7) An examiner awards the highest mark 75 and the lowest mark 25, the pass marks being 40. The moderator wants to change the highest mark to 250 and the lowest marks to 100 using the linear formula y=ax+b. The revised pass marks will be:&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;A. 145&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;B. 150&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;C. 160&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;D. 400/3&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;Give the correct option.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;y=ax+b&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;100=25a+b&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;250=75a+b&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;Solve it get and b and then put&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;y=40a+b&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;Answer: 145&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;8) A and B are shooters and having their exam. A and B fall short of 10 and 2 shots respectively to the qualifying mark. If each of them fired at least one shot and even by adding their total score together, they fall short of the qualifying mark, what is the qualifying mark?&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;Answer: 11&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;As A is short by 10 - he has shot 1&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;As B is short by 2 - he has shot 9&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;9+1=10 and 10 &amp;lt; 11&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;9) In objective test a correct answer score 4 marks and on a wrong answer 2 marks. A student scores 480 marks from 150 questions. How many answers were correct?&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;A. 120&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;B. 130&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;C. 110&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;D. 150&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;Answer: B i.e. 130&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;4x-2y=480&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;x+y=150&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;Then X is 130 so 130 is correct answer.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;11) A guy walks at 4 mph from a point. After 4 hrs a cyclist starts from the same point at 10 mph. At what distance will they meet from the starting point?&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;Answer: 26.66 m&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;Explanation: We have, s=vt where s=distance. Since both meet at same point, both travels same distance=s km. Now, equating, 10(t+4) = 4t ------&amp;gt; t=20/3&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;sub. t=20/3 in s=4t---------&amp;gt; s = 26.66km&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;12) What's the difference between COPY OF A FILE &amp;amp; MOVE_UPLOAD_FILE in file uploading?&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;Move: This function checks to ensure that the file designated by filename is a valid upload file (meaning that it was uploaded via PHP's HTTP POST upload mechanism). If the file is valid, it will be moved to the filename given by destination.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;If filename is not a valid upload file, then no action will occur, and move_uploaded_file() will return FALSE.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;Copy: Makes a copy of a file. Returns TRUE if the copy succeeded, FALSE otherwise.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;13) How do you insert single &amp;amp; double quotes in MySQL db without using PHP?&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;&amp;amp;amp; / &amp;amp;quote;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;Alternately, escape single quote using forward slash ' . In double quote you don't need to escape quotes. Insert double quotes as "".&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;14) What do you need to do to improve the performance of the script you have written?&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;If your script is to retrieve data from Database, you should use "Limit" syntax. Break down the non dynamic sections of website which need not be repeated over a period of time as include files.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;15) How do you capture audio/video in PHP?&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;You need a module installed - FFMPEG. FFmpeg is a complete solution to record, convert and stream audio and video. It includes libavcodec, the leading audio/video codec library. FFmpeg is developed under Linux, but it can be compiled under most operating systems, including Windows.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;16) How do you know whether the recipient of your mail had opened the mail i.e. read the mail?&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;Embed an URL in a say 0-byte image tag may be the better way to go. In other word, you embed an invisible image on you html&amp;nbsp;&lt;a href="http://www.blogger.com/post-edit.g?blogID=5173447009686155144&amp;amp;postID=4689765542612561999"&gt;&lt;span class="Apple-style-span" style="color: black;"&gt;email&lt;/span&gt;&lt;/a&gt;&amp;nbsp;and when the src URL is being rendered by the server, you can track whether your recipients have view the emails or not.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;17) What is random number?&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;A random number is a number generated by a process, whose outcome is unpredictable, and which cannot be sub sequentially reliably reproduced.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;18) What is difference between srand &amp;amp; shuffle?&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;The srand function seeds the random number generator with seed and shuffle is used for shuffling the array values.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;shuffle - This function shuffles (randomizes the order of the elements in) an array. This function assigns new keys for the elements in array. It will remove any existing keys you may have assigned, rather than just reordering the keys.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;srand - Seed the random number generator&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;19) How can we remove duplicate values from an array?&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;array_unique() funciton can be used for the purpose.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;20) How do I find out weather a number is odd or even?&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;if (number%2==0 ) then even else odd.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;21) How can we get the ID generated from the previous insert operation?&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;SELECT MAX(ID) from tablename;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;22) How to limit the number of rows to 5 that I get out of my database?&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;Select * from tablename LIMIT 0, 5;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;23) How to store binary data in MySQL?&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;Use BLOB data type for the database field.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;24) How can we submit a form without a submit button?&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style="margin-top: 0in;"&gt;&lt;span style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial;"&gt;We can submit a form using the JavaScript. Example: document.formname.submit();&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-4689765542612561999?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/4689765542612561999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2010/06/php-interview-questions-with-answers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/4689765542612561999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/4689765542612561999'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2010/06/php-interview-questions-with-answers.html' title='PHP Interview Questions with Answers'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-7937171087402554313</id><published>2010-06-18T11:05:00.000+05:30</published><updated>2010-06-18T11:05:48.196+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='interview questions'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='interview'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='php interview questions and answers'/><category scheme='http://www.blogger.com/atom/ns#' term='questions'/><title type='text'></title><content type='html'>&lt;div class="MsoNormal"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="color: #38761d;"&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Trebuchet MS', sans-serif;"&gt;PHP Interview Questions and Answers&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;1 What does a special set of tags  do in PHP? &lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;– The output is displayed directly to the browser.&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;2&amp;nbsp; What’s the difference between include and require?&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;It’s how they handle failures. If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;3&amp;nbsp; I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what’s the problem?&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;PHP Interpreter treats numbers beginning with 0 as octal. Look at the similar PHP interview questions for more numeric problems.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;4&amp;nbsp;&amp;nbsp; Would I use print "$a dollars" or "{$a} dollars" to print out the amount of dollars in this example? –&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;In this example it wouldn’t matter, since the variable is all by itself, but if you were to print something like "{$a},000,000 mln dollars", then you definitely need to use the braces.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;5&amp;nbsp;&amp;nbsp; How do you define a constant? –&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;Via define() directive, like define ("MYCONSTANT", 100);&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;6&amp;nbsp;&amp;nbsp; How do you pass a variable by value? –&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;Just like in C++, put an ampersand in front of it, like $a = &amp;amp;$b&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;7&amp;nbsp;&amp;nbsp; Will comparison of string "10" and integer 11 work in PHP? -&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;Yes, internally PHP will cast everything to the integer type, so numbers 10 and 11 will be compared.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;8&amp;nbsp;&amp;nbsp; When are you supposed to use endif to end the conditional statement? –&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;When the original if was followed by : and then the code block without braces.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;9&amp;nbsp;&amp;nbsp; Explain the ternary conditional operator in PHP? –&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;Expression preceding the ? is evaluated, if it’s true, then the expression preceding the : is executed, otherwise, the expression following : is executed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;10&amp;nbsp; How do I find out the number of parameters passed into function? –&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;func_num_args() function returns the number of parameters passed in.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;11&amp;nbsp;&amp;nbsp; If the variable $a is equal to 5 and variable $b is equal to character a, what’s the value of $$b? –&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;100, it’s a reference to existing variable.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;12&amp;nbsp;&amp;nbsp; What’s the difference between accessing a class method via -&amp;gt; and via ::? –&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;:: is allowed to access methods that can perform static operations, i.e. those, which do not require object initialization.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;13&amp;nbsp;&amp;nbsp; Are objects passed by value or by reference? –&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;Everything is passed by value.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;14&amp;nbsp;&amp;nbsp; How do you call a constructor for a parent class? –&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;parent::constructor($value)&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;15&amp;nbsp;&amp;nbsp; What’s the special meaning of __sleep and __wakeup? –&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;__sleep returns the array of all the variables than need to be saved, while __wakeup retrieves them.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;16&amp;nbsp; Why doesn’t the following code print the newline properly?&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$str = ‘Hello, there.nHow are you?’;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;print $str;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;?&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;Because inside the single quotes the n character is not interpreted as newline, just as a sequence of two characters – and n.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;17&amp;nbsp;&amp;nbsp; Would you initialize your strings with single quotes or double quotes? –&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;Since the data inside the single-quoted string is not parsed for variable substitution, it’s always a better idea speed-wise to initialize a string with single quotes, unless you specifically need variable substitution.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;18&amp;nbsp; How come the code  works, but  doesn’t for two-dimensional array of mine? –&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;Any time you have an array with more than one dimension, complex parsing syntax is required. print "Contents: {$arr[1][2]}" would’ve worked.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;19&amp;nbsp;&amp;nbsp; What is the difference between characters 23 and x23? –&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;The first one is octal 23, the second is hex 23.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;20&amp;nbsp; With a heredoc syntax, do I get variable substitution inside the heredoc contents? –&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;Yes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;21&amp;nbsp; I want to combine two variables together:&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;$var1 = 'Welcome to ';&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;$var2 = 'Tech";&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;What will work faster? Code sample 1:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;$var 3 = $var1.$var2;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;Or code sample 2:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;$var3 = "$var1$var2";&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;Both examples would provide the same result – $var3 equal to "Welcome to Tech". However, Code Sample 1 will work significantly faster. Try it out with large sets of data (or via concatenating small sets a million times or so), and you will see that concatenation works significantly faster than variable substitution.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;22 For printing out strings, there are echo, print and printf. Explain the differences.&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;– echo is the most primitive of them, and just outputs the contents following the construct to the screen. print is also a construct (so parentheses are optional when calling it), but it returns TRUE on successful output and FALSE if it was unable to print out the string. However, you can pass multiple parameters to echo, like:&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;and it will output the string "Welcome to Tech!" print does not take multiple parameters. It is also generally argued that echo is faster, but usually the speed advantage is negligible, and might not be there for future versions of PHP. printf is a function, not a construct, and allows such advantages as formatted output, but it’s the slowest way to print out data out of echo, print and printf.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;23&amp;nbsp; I am writing an application in PHP that outputs a printable version of driving directions. It contains some long sentences, and I am a neat freak, and would like to make sure that no line exceeds 50 characters. How do I accomplish that with PHP? –&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;On large strings that need to be formatted according to some length specifications, use wordwrap() or chunk_split().&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;24&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; What’s the output of the ucwords function in this example?&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;$formatted = ucwords("TECHI IS COLLECTION OF INTERVIEW QUESTIONS");&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="mso-tab-count: 1;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;print $formatted;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;What will be printed is TECHIN IS COLLECTION OF INTERVIEW QUESTIONS.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;ucwords() makes every first letter of every word capital, but it does not lower-case anything else. To avoid this, and get a properly formatted string, it’s worth using strtolower() first.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;25&amp;nbsp;&amp;nbsp; What’s the difference between htmlentities() and htmlspecialchars()?&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;– htmlspecialchars only takes care of &amp;lt;, &amp;gt;, single quote ‘, double quote " and ampersand. htmlentities translates all occurrences of character sequences that have different meaning in HTML.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;26&amp;nbsp;&amp;nbsp;&amp;nbsp; What’s the difference between md5(), crc32() and sha1() crypto on PHP?&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&amp;nbsp;– The major difference is the length of the hash generated. CRC32 is, evidently, 32 bits, while sha1() returns a 128 bit value, and md5() returns a 160 bit value. This is important when avoiding collisions.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;27&amp;nbsp;&amp;nbsp;So if md5() generates the most secure hash, why would you ever use the less secure crc32() and sha1()? &lt;/b&gt;– Crypto usage in PHP is simple, but that doesn’t mean it’s free. First off, depending on the data that you’re encrypting, you might have reasons to store a 32-bit value in the database instead of the 160-bit value to save on space. Second, the more secure the crypto is, the longer is the computation time to deliver the hash value. A high volume site might be significantly slowed down, if frequent md5() generation is required.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-7937171087402554313?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/7937171087402554313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2010/06/php-interview-questions-and-answers-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/7937171087402554313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/7937171087402554313'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2010/06/php-interview-questions-and-answers-1.html' title=''/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-2475779898624625208</id><published>2010-01-04T20:47:00.000+05:30</published><updated>2010-01-04T20:47:56.545+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Static Keyword in PHP'/><title type='text'>Static Keyword in PHP</title><content type='html'>&lt;h2 class="title"&gt;Static Keyword&lt;/h2&gt;&lt;div class="para"&gt;Declaring class members or methods as static makes them accessible  without needing an instantiation of the class. A member declared as static can  not be accessed with an instantiated class object (though a static method can).  &lt;br /&gt;&lt;/div&gt;&lt;div class="para"&gt;For compatibility with PHP 4, if no visibility declaration is used, then  the member or method will be treated as if it was declared as &lt;i&gt;public&lt;/i&gt;.  &lt;br /&gt;&lt;/div&gt;&lt;div class="para"&gt;Because static methods are callable without an instance of the  object created, the pseudo variable &lt;var class="varname"&gt;$this&lt;/var&gt; is not  available inside the method declared as static. &lt;br /&gt;&lt;/div&gt;&lt;div class="para"&gt;Static properties cannot be accessed through the object using the  arrow operator -&amp;gt;. &lt;br /&gt;&lt;/div&gt;&lt;div class="para"&gt;Calling non-static methods statically generates an E_STRICT level  warning. &lt;br /&gt;&lt;/div&gt;&lt;div class="para"&gt;Like any other PHP static variable, static properties may only be  initialized using a literal or constant; expressions are not allowed. So while  you may initialize a static property to an integer or array (for instance), you  may not initialize it to another variable, to a function return value, or to an  object. &lt;br /&gt;&lt;/div&gt;&lt;div class="para"&gt;As of PHP 5.3.0, it's possible to reference the class using a  variable. The variable's value can not be a keyword (e.g. &lt;i&gt;self&lt;/i&gt;,  &lt;i&gt;parent&lt;/i&gt; and &lt;i&gt;static&lt;/i&gt;). &lt;br /&gt;&lt;/div&gt;&lt;div class="example"&gt;&lt;b&gt;Static member example&lt;/b&gt;&lt;br /&gt;&lt;div class="example-contents programlisting"&gt;&lt;div class="phpcode"&gt;&lt;code&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Foo&lt;br /&gt;&lt;/span&gt; &lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;static&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$my_static&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;'foo'&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;function&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;staticValue&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;()&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;self&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;::&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$my_static&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Bar&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;extends&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Foo&lt;br /&gt;&lt;/span&gt; &lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;function&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;fooStatic&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;()&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;parent&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;::&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$my_static&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Foo&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;::&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$my_static&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;"\n"&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;;&lt;br /&gt;&lt;/span&gt; &lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$foo&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;=&amp;nbsp;new&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Foo&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;();&lt;br /&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$foo&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;staticValue&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;()&amp;nbsp;.&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;"\n"&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;;&lt;br /&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$foo&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;my_static&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;"\n"&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;//&amp;nbsp;Undefined&amp;nbsp;"Property"&amp;nbsp;my_static&lt;br /&gt;&lt;/span&gt; &lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$foo&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;::&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$my_static&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;"\n"&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;;&lt;br /&gt;&lt;/span&gt; &lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$classname&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;'Foo'&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;;&lt;br /&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$classname&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;::&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$my_static&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;"\n"&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;//&amp;nbsp;As&amp;nbsp;of&amp;nbsp;PHP&amp;nbsp;5.3.0&lt;br /&gt;&lt;/span&gt; &lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Bar&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;::&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$my_static&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;.&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;"\n"&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;;&lt;br /&gt;&lt;/span&gt; &lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$bar&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;=&amp;nbsp;new&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Bar&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;();&lt;br /&gt;print&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$bar&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;fooStatic&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;()&amp;nbsp;.&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;"\n"&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;;&lt;br /&gt;&lt;/span&gt; &lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;?&amp;gt;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;  &lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="example"&gt;&lt;b&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Static method example&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;div class="example-contents programlisting"&gt;&lt;div class="phpcode"&gt;&lt;code&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;class&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Foo&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;static&amp;nbsp;function&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;aStaticMethod&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;()&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;//&amp;nbsp;...&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt; &lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Foo&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;::&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;aStaticMethod&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;();&lt;br /&gt;&lt;/span&gt; &lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$classname&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;'Foo'&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;;&lt;br /&gt;&lt;/span&gt; &lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$classname&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;::&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;aStaticMethod&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;();&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;//&amp;nbsp;As&amp;nbsp;of&amp;nbsp;PHP&amp;nbsp;5.3.0&lt;br /&gt;&lt;/span&gt; &lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;?&amp;gt;&lt;/span&gt; &lt;/code&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-2475779898624625208?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/2475779898624625208/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2010/01/static-keyword-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/2475779898624625208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/2475779898624625208'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2010/01/static-keyword-in-php.html' title='Static Keyword in PHP'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-1131874661527308354</id><published>2010-01-04T20:42:00.000+05:30</published><updated>2010-01-04T20:44:49.936+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Class Abstraction in PHP'/><title type='text'>Class Abstraction in PHP</title><content type='html'>&lt;h2 class="title"&gt;Class Abstraction&lt;/h2&gt;&lt;div class="para"&gt;PHP 5 introduces abstract classes and methods. It is not allowed  to create an instance of a class that has been defined as abstract. Any class  that contains at least one abstract method must also be abstract. Methods  defined as abstract simply declare the method's signature they cannot define the  implementation. &lt;br /&gt;&lt;/div&gt;&lt;div class="para"&gt;When inheriting from an abstract class, all methods marked  abstract in the parent's class declaration must be defined by the child;  additionally, these methods must be defined with the same (or a less restricted)  &lt;a class="link" href="http://www.blogger.com/post-create.g?blogID=5173447009686155144"&gt;visibility&lt;/a&gt;. For example,  if the abstract method is defined as protected, the function implementation must  be defined as either protected or public, but not private. &lt;br /&gt;&lt;/div&gt;&lt;div class="example"&gt;&lt;b&gt;&lt;span style="color: #38761d;"&gt;Abstract class example&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;div class="example-contents programlisting"&gt;&lt;div class="phpcode"&gt;&lt;code&gt;&lt;span style="color: black;"&gt;&lt;span style="color: #0000bb;"&gt;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;abstract&amp;nbsp;class&amp;nbsp;AbstractClass&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;Force&amp;nbsp;Extending&amp;nbsp;class&amp;nbsp;to&amp;nbsp;define&amp;nbsp;this&amp;nbsp;method&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;abstract&amp;nbsp;protected&amp;nbsp;function&amp;nbsp;getValue();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;abstract&amp;nbsp;protected&amp;nbsp;function&amp;nbsp;prefixValue($prefix);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//&amp;nbsp;Common&amp;nbsp;method&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;function&amp;nbsp;printOut()&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;print&amp;nbsp;$this-&amp;gt;getValue()&amp;nbsp;.&amp;nbsp;"\n";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&amp;nbsp;class&amp;nbsp;ConcreteClass1&amp;nbsp;extends&amp;nbsp;AbstractClass&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;protected&amp;nbsp;function&amp;nbsp;getValue()&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;"ConcreteClass1";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; public&amp;nbsp;function&amp;nbsp;prefixValue($prefix)&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;"{$prefix}ConcreteClass1";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&amp;nbsp;class&amp;nbsp;ConcreteClass2&amp;nbsp;extends&amp;nbsp;AbstractClass&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&amp;nbsp;function&amp;nbsp;getValue()&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;"ConcreteClass2";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; public&amp;nbsp;function&amp;nbsp;prefixValue($prefix)&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;"{$prefix}ConcreteClass2";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;$class1&amp;nbsp;=&amp;nbsp;new&amp;nbsp;ConcreteClass1;&lt;br /&gt;$class1-&amp;gt;printOut();&lt;br /&gt;echo&amp;nbsp;$class1-&amp;gt;prefixValue('FOO_')&amp;nbsp;."\n";&lt;br /&gt;&lt;br /&gt;$class2&amp;nbsp;=&amp;nbsp;new&amp;nbsp;ConcreteClass2;&lt;br /&gt;$class2-&amp;gt;printOut();&lt;br /&gt;echo&amp;nbsp;$class2-&amp;gt;prefixValue('FOO_')&amp;nbsp;."\n"&lt;/span&gt;       &lt;span style="color: #007700;"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="example-contents para"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;The above example will output:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="example-contents screen"&gt;&lt;div class="cdata"&gt;&lt;pre&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;ConcreteClass1&lt;br /&gt;FOO_ConcreteClass1&lt;br /&gt;ConcreteClass2&lt;br /&gt;FOO_ConcreteClass2&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="para"&gt;Old code that has no user-defined classes or functions named  'abstract' should run without modifications.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-1131874661527308354?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/1131874661527308354/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2010/01/class-abstraction-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/1131874661527308354'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/1131874661527308354'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2010/01/class-abstraction-in-php.html' title='Class Abstraction in PHP'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-5027236564832086594</id><published>2010-01-04T20:08:00.000+05:30</published><updated>2010-01-04T20:10:17.055+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Constructor'/><category scheme='http://www.blogger.com/atom/ns#' term='constructors in php'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>Constructors in PHP</title><content type='html'>&lt;h2 class="title"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Constructors&lt;/span&gt;&lt;/h2&gt;&lt;div class="para"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Constructors are functions in a class that are automatically  called when you create a new instance of a class with &lt;/span&gt;&lt;i&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;new&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;. A function  becomes a constructor, when it has the same name as the class. If a class has no  constructor, the constructor of the base class will be called, if it exists.  &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;div class="example-contents programlisting"&gt;&lt;div class="phpcode"&gt;&lt;code&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;span style="color: #0000bb;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;class&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Auto_Cart&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;extends&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Cart&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Auto_Cart&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;()&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;-&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;add_item&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #dd0000;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;"10"&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;This defines a class Auto_Cart that is a Cart plus a constructor  which initializes the cart with one item of article number "10" each time a new  Auto_Cart is being made with "&lt;/span&gt;&lt;i&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;new&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;". Constructors can take arguments and  these arguments can be optional, which makes them much more useful. To be able  to still use the class without parameters, all parameters to constructors should  be made optional by providing default values. &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;div class="example-contents programlisting"&gt;&lt;div class="phpcode"&gt;&lt;code&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;span style="color: #0000bb;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;class&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Constructor_Cart&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;extends&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Cart&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Constructor_Cart&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$item&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #dd0000;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;"10"&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$num&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;=&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;)&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$this&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;-&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;add_item&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$item&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$num&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;  &lt;/span&gt;&lt;span style="color: #ff8000;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;//&amp;nbsp;Shop&amp;nbsp;the&amp;nbsp;same&amp;nbsp;old&amp;nbsp;boring&amp;nbsp;stuff.&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$default_cart&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;=&amp;nbsp;new&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Constructor_Cart&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;  &lt;/span&gt;&lt;span style="color: #ff8000;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;//&amp;nbsp;Shop&amp;nbsp;for&amp;nbsp;real...&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$different_cart&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;=&amp;nbsp;new&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;Constructor_Cart&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #dd0000;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;"20"&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;17&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;);&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;You also can use the &lt;/span&gt;&lt;i&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;@&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt; operator to &lt;/span&gt;&lt;em class="emphasis"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;mute&lt;/span&gt;&lt;/em&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt; errors occurring in the constructor, e.g. &lt;/span&gt;&lt;i&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;@new&lt;/span&gt;&lt;/i&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;.  &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="informalexample"&gt;&lt;div class="example-contents programlisting"&gt;&lt;div class="phpcode"&gt;&lt;code&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;span style="color: #0000bb;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;class&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;A&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;function&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;A&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;()&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #dd0000;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;"I&amp;nbsp;am&amp;nbsp;the&amp;nbsp;constructor&amp;nbsp;of&amp;nbsp;A.&lt;/span&gt;&lt;br&amp;nbsp;&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;\n"&lt;/span&gt;&lt;/br&amp;nbsp;&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; function&amp;nbsp;&lt;/span&gt; &lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;B&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;()&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #dd0000;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;"I&amp;nbsp;am&amp;nbsp;a&amp;nbsp;regular&amp;nbsp;function&amp;nbsp;named&amp;nbsp;B&amp;nbsp;in&amp;nbsp;class&amp;nbsp;A.&lt;/span&gt;&lt;br&amp;nbsp;&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;\n"&lt;/span&gt;&lt;/br&amp;nbsp;&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #dd0000;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;"I&amp;nbsp;am&amp;nbsp;not&amp;nbsp;a&amp;nbsp;constructor&amp;nbsp;in&amp;nbsp;A.&lt;/span&gt;&lt;br&amp;nbsp;&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;\n"&lt;/span&gt;&lt;/br&amp;nbsp;&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class&amp;nbsp;&lt;/span&gt; &lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;B&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;extends&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;A&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;{&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;  &lt;/span&gt;&lt;span style="color: #ff8000;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;//&amp;nbsp;This&amp;nbsp;will&amp;nbsp;call&amp;nbsp;B()&amp;nbsp;as&amp;nbsp;a&amp;nbsp;constructor&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;$b&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;=&amp;nbsp;new&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;B&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #007700;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;;&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;span style="color: #0000bb;"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;The function B() in class A will suddenly become a constructor in  class B, although it was never intended to be. PHP 4 does not care if the  function is being defined in class B, or if it has been inherited. &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="caution"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="para"&gt;&lt;span style="font-family: 'Helvetica Neue', Arial, Helvetica, sans-serif;"&gt;&lt;span style="color: #38761d;"&gt;Destructors&lt;/span&gt; are functions that are called automatically when an  object is destroyed, either with unset() or by simply going out of scope. There  are no destructors in PHP. You may use register_shutdown_function()  instead to simulate most effects of destructors.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-5027236564832086594?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/5027236564832086594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2010/01/constructors-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/5027236564832086594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/5027236564832086594'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2010/01/constructors-in-php.html' title='Constructors in PHP'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-6989203443107281804</id><published>2009-08-18T20:15:00.000+05:30</published><updated>2010-01-04T19:50:06.952+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='interview questions'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='php interview questions and answers'/><title type='text'>PHP Mysql Interview Questions and Answers</title><content type='html'>&lt;span style="font-weight: bold;"&gt;What are the differences between Get and post methods in form submitting.&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;give the case where we can use get and we can use post methods?&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;When to use GET or POST &lt;br /&gt;The HTML 2.0 specification says, in section Form Submission (and the HTML 4.0 specification repeats this with minor stylistic changes): &lt;br /&gt;–&amp;gt;If the processing of a form is idempotent (i.e. it has no lasting observable effect on the state of the world), then the form method should be GET. Many database searches have no visible side-effects and make ideal applications of query forms. &lt;br /&gt;–&amp;gt;If the service associated with the processing of a form has side effects (for example, modification of a database or subscription to a service), the method should be POST. &lt;br /&gt;&lt;br /&gt;How the form data is transmitted? quotation from the HTML 4.0 specification &lt;br /&gt;–&amp;gt; If the method is “get” – -, the user agent takes the value of action, appends a ? to it, then appends the form data set, encoded using the application/x-www-form-urlencoded &lt;br /&gt;content type. The user agent then traverses the link to this URI. In this scenario, form data are restricted to ASCII codes. &lt;br /&gt;–&amp;gt; If the method is “post” –, the user agent conducts an HTTP post transaction using the value of the action attribute and a message created according to the content type specified by the enctype attribute. Quote from CGI FAQ &lt;br /&gt;&lt;br /&gt;Firstly, the the HTTP protocol specifies differing usages for the two methods. GET requests should always be idempotent on the server. This means that whereas one GET request &lt;br /&gt;might (rarely) change some state on the Server, two or more identical requests will have no further effect. &lt;br /&gt;&lt;br /&gt;This is a theoretical point which is also good advice in practice. If a user hits “reload” on his/her browser, an identical request will be sent to the server, potentially resulting &lt;br /&gt;in two identical database or guestbook entries, counter increments, etc. Browsers may reload a &lt;br /&gt;GET URL automatically, particularly if cacheing is disabled (as is usually the case with CGI output), but will typically prompt the user before re-submitting a POST request. This means you’re far less likely to get inadvertently-repeated entries from POST. &lt;br /&gt;&lt;br /&gt;GET is (in theory) the preferred method for idempotent operations, such as querying a database, though it matters little if you’re using a form. There is a further practical constraint that many systems have built-in limits to the length of a &lt;br /&gt;GET request they can handle: when the total size of a request (URL+params) approaches or exceeds 1Kb, you are well-advised to use POST in any case. &lt;br /&gt;&lt;br /&gt;I would prefer POST when I don’t want the status to be change when user resubmits. And GET &lt;br /&gt;when it does not matter. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Who is the father of PHP and explain the changes in PHP versions?&lt;/span&gt; &lt;br /&gt;Rasmus Lerdorf is known as the father of PHP.PHP/FI 2.0 is an early and no longer supported version of PHP. PHP 3 is the successor to PHP/FI 2.0 and is a lot nicer. PHP 4 is the current generation of PHP, which uses the Zend engine under the hood. PHP 5 uses Zend engine 2 which, among other things, offers many additionalOOP features &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How can we submit a form without a submit button?&lt;/span&gt; &lt;br /&gt;The main idea behind this is to use Java script submit() function in order to submit the form without explicitly clicking any submit button. You can attach the document.formname.submit() method to onclick, onchange events of different inputs and perform the form submission. you &lt;br /&gt;can even built a timer function where you can automatically submit the form after xx seconds once the loading is done (can be seen in online test sites). &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;In how many ways we can retrieve the data in the result set of&lt;/span&gt; &lt;br /&gt;&lt;span style="font-weight: bold;"&gt;MySQL using PHP?&lt;/span&gt; &lt;br /&gt;You can do it by 4 Ways &lt;br /&gt;1. mysql_fetch_row. &lt;br /&gt;2. mysql_fetch_array &lt;br /&gt;3. mysql_fetch_object &lt;br /&gt;4. mysql_fetch_assoc &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is the difference between mysql_fetch_object and&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;mysql_fetch_array?&lt;/span&gt; &lt;br /&gt;A:5 mysql_fetch_object() is similar tomysql_fetch_array(), with one difference - an object is returned, instead of an array. Indirectly, that means that you can only access the data by the field names, and not by their offsets (numbers are illegal property names). &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is the difference between $message and $$message?&lt;/span&gt; &lt;br /&gt;It is a classic example of PHP’s variable variables. take the following example.$message = “Mizan”;$message = “is a moderator of PHPXperts.”;$message is a simple PHP variable that we are used to. But the $message is not a very familiar face. It creates a variable name $mizan &lt;br /&gt;with the value “is a moderator of PHPXperts.” assigned. break it like this${$message} =&amp;gt; $mizanSometimes it is convenient to be able to have variable variable names. That is, a variable name which can be set and used dynamically. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How can we extract string ‘abc.com ‘ from a string ‘http://info@abc.com’&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;using regular expression of PHP?&lt;/span&gt; &lt;br /&gt;preg_match(”/^http:\/\/.+@(.+)$/”,’http://info@abc.com’,$found); echo $found[1]; &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;can we create a database using PHP and MySQL?&lt;/span&gt; &lt;br /&gt;can create MySQL database with the use of mysql_create_db(“Database Name”) &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What are the differences between require and include, include_once and require_once?&lt;/span&gt; &lt;br /&gt;The include() statement includes and evaluates the specified file.The documentation below also applies to require(). The two constructs are identical in every way except how they handle &lt;br /&gt;failure. include() produces a Warning while require() results in a Fatal Error. In other words, use &lt;br /&gt;require() if you want a missing file to halt processing of the page. &lt;br /&gt;include() does not behave this way, the script will continue regardless. &lt;br /&gt;&lt;br /&gt;The include_once() statement includes and evaluates the specified file during the execution of the script. This is a behavior similar to the include() statement, with the only difference being that if the code from a file has already been included, it will not be included again. As the name suggests, it will be included just once.include_once() should be used in cases where the same file might be included and evaluated more than once during a particular execution of a script, and you want to be sure that it is included exactly once to avoid problems with function &lt;br /&gt;redefinitions, variable value reassignments, etc. &lt;br /&gt;&lt;br /&gt;require_once() should be used in cases where the same file might be included and evaluated more than once during a particular execution of a script, and you want to be sure that it is included exactly once to avoid problems with function redefinitions, variable value reassignments, etc. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Can we use include (”abc.PHP”) two times in a PHP page “makeit.PHP”?&lt;/span&gt; &lt;br /&gt;Yes we can use include() more than one time in any page though it is not a very good practice. &lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What are the different tables present in MySQL, which type of table is generated when we are creating a table in the following syntax: &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;create table employee (eno int(2),ename varchar(10)) ?&lt;/span&gt; &lt;br /&gt;can create &lt;br /&gt;1. MyISAM &lt;br /&gt;2. Heap &lt;br /&gt;3. Merge &lt;br /&gt;4. INNO DB &lt;br /&gt;5. ISAM and etc.. &lt;br /&gt;MyISAM is the default storage engine as of MySQL 3.23 and as a result if we do not specify the table name explicitly it will be assigned to the default engine. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Functions in IMAP, POP3 AND LDAP?&lt;/span&gt; &lt;br /&gt;You can find these specific information in PHP Manual. &lt;br /&gt;&lt;style type="text/css"&gt;  &lt;!--   @page { margin: 0.79in }   P { margin-bottom: 0.08in }   A:link { so-language: zxx }  --&gt;  &lt;/style&gt; &lt;br /&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;a href="http://fi2.php.net/imap"&gt;http://fi2.php.net/imap&lt;/a&gt; &lt;br /&gt;&lt;br /&gt;&lt;a href="http://uk2.php.net/ldap"&gt;http://uk2.php.net/ldap&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How can I execute a PHP script using command line?&lt;/span&gt; &lt;br /&gt;As of version 4.3.0, PHP supports a new SAPI type (Server Application Programming Interface) named CLI which means Command Line Interface. Just run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line argument. For example, “php myScript.php”, assuming “php” is the command to invoke the CLI program. Be aware that if your PHP script was written for the Web CGI interface, &lt;br /&gt;it may not execute properly in command line environment. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Suppose your Zend engine supports the mode Then how can u configure your PHP Zend engine to support mode ?&lt;/span&gt; &lt;br /&gt;In php.ini file: &lt;br /&gt;set &lt;br /&gt;short_open_tag=on &lt;br /&gt;to make PHP support &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Shopping cart online validation i.e. how can we configure Paypal, etc.?&lt;/span&gt; &lt;br /&gt;We can find the detail documentation about different paypal integration process at the following site &lt;br /&gt;PayPal PHP &lt;br /&gt;SDK : http://www.paypaldev.org &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is meant by nl2br()?&lt;/span&gt; &lt;br /&gt;HTML line breaks () before all newlines in a string string nl2br (string); Returns string with ” inserted before all newlines. For example: echo nl2br(”god bless\n you”) will output “god &lt;br /&gt;bless you” to your browser. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Draw the architecture of Zend engine?&lt;/span&gt; &lt;br /&gt;The Zend Engine is the internal compiler and runtime engine used by PHP4. Developed by Zeev Suraski and Andi Gutmans, the Zend Engine is an abbreviation of their names. In the early days of PHP4, it worked as follows: &lt;br /&gt;The PHP script was loaded by the Zend Engine and compiled into Zend opcode. Opcodes, short for operation codes, are low level binary instructions. Then the opcode was executed and the HTML generated sent to the client. The opcode was flushed from memory after execution. Today, there are a multitude of products and techniques to help you speed up this process. In the following diagram, we show the how modern PHP scripts work; all the shaded boxes are optional. &lt;br /&gt;PHP Scripts are loaded into memory and compiled into Zend opcodes. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What are the current versions of apache, PHP, and MySQL?&lt;/span&gt; &lt;br /&gt;As of February, 2007 the current versions arePHP: php5.2.1 &lt;br /&gt;MySQL: MySQL 5.2 &lt;br /&gt;Apache: Apache 2.2.4Note: visit www.php.net, &lt;br /&gt;&lt;br /&gt;http://dev.mysql.com/downloads/mysql/, &lt;br /&gt;www.apache.org to get current &lt;br /&gt;versions. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What are the reasons for selecting lamp (Linux, apache, MySQL,&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;PHP) instead of combination of other software programs, servers and &lt;/span&gt;&lt;span style="font-weight: bold;"&gt;operating systems?&lt;/span&gt; &lt;br /&gt;A:19 All of those are open source resource. Security of Linux is very very more than windows. Apache is a better server that IIS both in functionality and security. MySQL is world most popular open source database. PHP is more faster that asp or any other scripting language. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How can we encrypt and decrypt a data present in a MySQL table&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;using MySQL?&lt;/span&gt; &lt;br /&gt;AES_ENCRYPT () and AES_DECRYPT () &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How can we encrypt the username and password using PHP?&lt;/span&gt; &lt;br /&gt;The functions in this section perform encryption and decryption, and compression and uncompression: &lt;br /&gt;encryption decryption &lt;br /&gt;AES_ENCRYT() AES_DECRYPT() &lt;br /&gt;ENCODE() DECODE() &lt;br /&gt;DES_ENCRYPT() DES_DECRYPT() &lt;br /&gt;ENCRYPT() Not available &lt;br /&gt;MD5() Not available &lt;br /&gt;OLD_PASSWORD() Not available &lt;br /&gt;PASSWORD() Not available &lt;br /&gt;SHA() or SHA1() Not available &lt;br /&gt;Not available UNCOMPRESSED_LENGTH() &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What are the features and advantages of object-oriented&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;programming?&lt;/span&gt; &lt;br /&gt;One of the main advantages of OO programming is its ease of modification; objects can easily be modified and added to a system there by reducing maintenance costs. OO programming is also considered to be better at modeling the real world than is procedural programming. It allows for more complicated and flexible interactions. OO systems are &lt;br /&gt;also easier for non-technical personnel to understand and easier for them to participate in the maintenance and enhancement of a system because it appeals to natural human cognition patterns. &lt;br /&gt;For some systems, an OO approach can speed development time since many objects are standard across systems and can be reused. Components that manage dates, shipping, shopping carts, etc. can be purchased and easily modified for a specific system &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What are the differences between procedure-oriented languages and&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;object-oriented languages?&lt;/span&gt; &lt;br /&gt;Traditional programming has the following characteristics:Functions are written sequentially, so that a change in programming can affect any code that follows it. If a function is used multiple times in a system (i.e., a piece of code that manages the date), it is often simply cut and pasted into each program (i.e., a change log, order function, fulfillment system, etc). &lt;br /&gt;If a date change is needed (i.e., Y2K when the code needed to be changed to handle four numerical digits instead of two), all these pieces of code must be found, modified, and tested. &lt;br /&gt;Code (sequences of computer instructions) and data (information on which the instructions operates on) are kept separate. Multiple sets of code can access and modify one set of data. One set of code may rely on data in multiple places. Multiple sets of code and data are required to work together. Changes made to any of the code sets and data sets can cause problems through out the system.Object-Oriented programming takes a radically different approach:Code and data are merged into one indivisible item – an object (the term “component” has also been used to describe an object.) An object is an abstraction of a set of real-world things (for example, an object may be created around “date”) The object would contain all information and &lt;br /&gt;functionality for that thing (A date object it may contain labels like January, February, Tuesday, Wednesday. &lt;br /&gt;It may contain functionality that manages leap years, determines if it is a business day or a holiday, etc., See Fig. 1). Ideally, information about a particular thing should reside in only one place in a system. The information within an object is encapsulated (or hidden) from the &lt;br /&gt;rest of the system. A system is composed of multiple objects (i.e., date function, reports, &lt;br /&gt;order processing, etc., See Fig 2). When one object needs information from another object, a request is sent asking for specific information. (for example, a report object may need to know what today’s date is and will send a request to the date object) These requests are called &lt;br /&gt;messages and each object has an interface that manages messages. OO programming languages include features such as “class”, “instance”, “inheritance”, and “polymorphism” that increase the power and flexibility of an object. &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is the use of friend function?&lt;/span&gt; &lt;br /&gt;Sometimes a function is best shared among a number of different classes. Such functions can be declared either as member functions of one class or as global functions. In either case they can be set to be friends of other classes, by using a friend specifier in the class that is admitting them. Such functions can use all attributes of the class which names them as a friend, as if they were themselves members of that class. &lt;br /&gt;A friend declaration is essentially a prototype for a member function, but instead of requiring an implementation with the name of that class attached by the double colon syntax, a global function or member function of another class provides the match. &lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;What are the differences between public, private, protected, static, transient, final and volatile?&lt;/span&gt;&lt;br /&gt;Public: Public declared items can be accessed everywhere. &lt;br /&gt;Protected: Protected limits access to inherited and parent &lt;br /&gt;classes (and to the class that defines the item). &lt;br /&gt;Private: Private limits visibility only to the class that defines&amp;nbsp;the item.&lt;br /&gt;Static: A static variable exists only in a local function scope,&amp;nbsp;but it does not lose its value when program execution leaves this scope.&lt;br /&gt;Final: Final keyword prevents child classes from overriding a&amp;nbsp;method by prefixing the definition with final. If the class itself is&amp;nbsp;being defined final then it cannot be extended.&lt;br /&gt;transient: A transient variable is a variable that may not&amp;nbsp;be serialized.&lt;br /&gt;volatile: a variable that might be concurrently modified by multiple&amp;nbsp;threads should be declared volatile. Variables declared to be volatile&amp;nbsp;will not be optimized by the compiler because their value can change at&lt;br /&gt;any time. &lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Q:26 What are the different types of errors in PHP?&lt;/span&gt;&lt;br /&gt;A:26 Three are three types of errors:1. Notices: These are trivial,&amp;nbsp;non-critical errors that PHP encounters while executing a script – for&amp;nbsp;example, accessing a variable that has not yet been defined. By default,such errors are not displayed to the user at all – although, as you will&amp;nbsp;see, you can change this default behavior.2. Warnings: These are more serious errors – for example, attempting&amp;nbsp;to include() a file which does not exist. By default, these errors are&amp;nbsp;displayed to the user, but they do not result in script termination.3. Fatal errors: These are critical errors – for example,&lt;br /&gt;instantiating an object of a non-existent class, or calling a&amp;nbsp;non-existent function. These errors cause the immediate termination of&amp;nbsp;the script, and PHP’s default behavior is to display them to the user&amp;nbsp;when they take place.&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Q:27 What is the functionality of the function strstr and stristr?&lt;/span&gt;&lt;br /&gt;A:27 strstr: &lt;br /&gt;Returns part of haystack&amp;nbsp;string from the first occurrence of&amp;nbsp;needle to the end of&amp;nbsp;haystack.If needle is not found,&lt;br /&gt;returns FALSE. &lt;br /&gt;If needle is not a&amp;nbsp;string, it is converted to an integer and applied as the&amp;nbsp;ordinal value of a character.&amp;nbsp;This function is case-sensitive. For&amp;nbsp;case-insensitive searches, use&amp;nbsp;stristr().&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Q:28 What are the differences between PHP 3 and PHP 4 and PHP 5?&lt;/span&gt;&lt;br /&gt;A:28 Please read the release notes at&amp;nbsp;&lt;a href="http://www.php.net./"&gt;http://www.php.net.&lt;/a&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Q:29 How can we convert asp pages to PHP pages?&lt;/span&gt;&lt;br /&gt;A:29 there are lots of tools available for asp to PHP conversion. you can &lt;br /&gt;search Google for that. the best one is available at &lt;a href="http://asp2php.naken.cc./"&gt;http://asp2php.naken.cc./ &lt;/a&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Q:30 What is the functionality of the function htmlentities?&lt;/span&gt;&lt;br /&gt;A:30 Convert all applicable characters to HTML entities&amp;nbsp;This function is identical to htmlspecialchars() in all ways, except&amp;nbsp;with htmlentities(), all characters which have HTML character entity&amp;nbsp;equivalents are translated into these entities.&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Q:31 How can we get second of the current time using date function?&lt;/span&gt;&lt;br /&gt;A:31 $second = date(”s”); &lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Q:32 How can we convert the time zones using PHP?&lt;/span&gt;&lt;br /&gt;A:32 By using date_default_timezone_get and&amp;nbsp;date_default_timezone_set function on PHP 5.1.0&lt;br /&gt;', date(DATE_RFC1123, $stamp) ,'&lt;br /&gt;';?&amp;gt; &lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Q:33 What is meant by urlencode and urldocode?&lt;/span&gt;&lt;br /&gt;A:33 URLencode returns a string in which all non-alphanumeric characters &lt;br /&gt;except -_. have been replaced with a percent (%)&amp;nbsp;sign followed by two hex digits and spaces encoded as plus (+)&amp;nbsp;signs. It is encoded the same way that the posted data from a WWW form&amp;nbsp;is encoded, that is the same way as in&amp;nbsp;application/x-www-form-urlencoded media type.&amp;nbsp;urldecode decodes any %##&amp;nbsp;encoding in the given string.&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Q:34 What is the difference between the functions unlink and unset?&lt;/span&gt;&lt;br /&gt;A:34 unlink() deletes the given file from the file system.&lt;br /&gt;unset() makes a variable undefined. &lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Q:35 How can we register the variables into a session?&lt;/span&gt;&lt;br /&gt;A:35 $_SESSION[’name’] = “Mizan”; &lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Q:36 How can we get the properties (size, type, width, height) of an&amp;nbsp;image using PHP image functions?&lt;/span&gt;&lt;br /&gt;A:36 To know the Image type use exif_imagetype () function &lt;br /&gt;To know the Image size use getimagesize () function &lt;br /&gt;To know the image width use imagesx () function &lt;br /&gt;To know the image height use imagesy() function t &lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Q:37 How can we get the browser properties using PHP?&lt;/span&gt;&lt;br /&gt;A:37 By using &lt;br /&gt;$_SERVER['HTTP_USER_AGENT'] &lt;br /&gt;variable. &lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Q:38 What is the maximum size of a file that can be uploaded using PHP&amp;nbsp;and how can we change this?&lt;/span&gt;&lt;br /&gt;A:38 By default the maximum size is 2MB. and we can change the following &lt;br /&gt;setup at php.iniupload_max_filesize = 2M &lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Q:39 How can we increase the execution time of a PHP script?&lt;/span&gt;&lt;br /&gt;A:39 by changing the following setup at php.inimax_execution_time = 30 &lt;br /&gt;; Maximum execution time of each script, in seconds &lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Q:40 How can we take a backup of a MySQL table and how can we restore&amp;nbsp;it. ?&lt;/span&gt;&lt;br /&gt;A:40 To backup: BACKUP TABLE tbl_name[,tbl_name…] TO &lt;br /&gt;‘/path/to/backup/directory’ &lt;br /&gt;RESTORE TABLE tbl_name[,tbl_name…] FROM ‘/path/to/backup/directory’mysqldump: Dumping Table Structure and DataUtility to dump a database or a collection of database for backup or&amp;nbsp;for transferring the data to another SQL server (not necessarily a MySQL&amp;nbsp;server). The dump will contain SQL statements to create the table and/or&amp;nbsp;populate the table.&lt;br /&gt;-t, –no-create-info &lt;br /&gt;Don’t write table creation information (the CREATE TABLE statement). &lt;br /&gt;-d, –no-data &lt;br /&gt;Don’t write any row information for the table. This is very useful if&amp;nbsp;you just want to get a dump of the structure for a table!&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Q:41 How can we optimize or increase the speed of a MySQL select&amp;nbsp;query?&lt;/span&gt;&lt;br /&gt;A:41 &lt;br /&gt;* first of all instead of using select * from table1, use select&lt;br /&gt;column1, column2, column3.. from table1 &lt;br /&gt;* Look for the opportunity to introduce index in the table you are&amp;nbsp;querying.&lt;br /&gt;* use limit keyword if you are looking for any specific number of&amp;nbsp;rows from the result set.&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Q:42 How many ways can we get the value of current session id?&lt;/span&gt;&lt;br /&gt;A:42 session_id() returns the session id for the current session. &lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Q:43 How can we destroy the session, how can we unset the variable of&amp;nbsp;a session?&lt;/span&gt;&lt;br /&gt;A:43 session_unregister — Unregister a global variable from the current&amp;nbsp;session&lt;br /&gt;session_unset — Free all session variables &lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Q:44 How can we destroy the cookie?&lt;/span&gt;&lt;br /&gt;A:44 Set the cookie in past. &lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Q:45 How many ways we can pass the variable through the navigation&amp;nbsp;between the pages?&lt;/span&gt;&lt;br /&gt;A:45 &lt;br /&gt;* GET/QueryString&lt;br /&gt;* POST &lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Q:46 What is the difference between ereg_replace() and eregi_replace()?&lt;/span&gt;&lt;br /&gt;A:46 eregi_replace() function is identical to ereg_replace() except that&amp;nbsp;this ignores case distinction when matching alphabetic&amp;nbsp;characters.eregi_replace() function is identical to ereg_replace()&amp;nbsp;except that this ignores case distinction when matching alphabetic&amp;nbsp;characters.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Q:47 What are the different functions in sorting an array?&lt;/span&gt;&lt;br /&gt;A:47 Sort(), arsort(), &lt;br /&gt;asort(), ksort(), &lt;br /&gt;natsort(), natcasesort(), &lt;br /&gt;rsort(), usort(), &lt;br /&gt;array_multisort(), and &lt;br /&gt;uksort(). &lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Q:48 How can we know the count/number of elements of an array?&lt;/span&gt;&lt;br /&gt;A:48 2 ways &lt;br /&gt;a) sizeof($urarray) This function is an alias of count() &lt;br /&gt;b) count($urarray) &lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Q:49 What is the PHP predefined variable that tells the What types of&lt;/span&gt;&lt;br /&gt;&lt;b&gt;images that PHP supports? &lt;/b&gt;&lt;br /&gt;A:49 Though i am not sure if this is wrong or not, With the exif&amp;nbsp;extension you are able to work with image meta data.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Q:50 How can I know that a variable is a number or not using a&amp;nbsp;JavaScript?&lt;/span&gt;&lt;br /&gt;A:50 bool is_numeric ( mixed var) &lt;br /&gt;Returns TRUE if var is a number or a numeric string, FALSE otherwise.or use isNaN(mixed var)The isNaN() function is used to check if a value is not a number. &lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Q:51 List out some tools through which we can draw E-R diagrams for&lt;/span&gt;&lt;br /&gt;&lt;b&gt;mysql. &lt;/b&gt;&lt;br /&gt;A:51 Case Studio &lt;br /&gt;Smart Draw &lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Q:52 How can I retrieve values from one database server and store them&lt;/span&gt;&lt;br /&gt;&lt;b&gt;in other database server using PHP? &lt;/b&gt;&lt;br /&gt;A:52 we can always fetch from one database and rewrite to another. here &lt;br /&gt;is a nice solution of it.$db1 = mysql_connect(”host”,”user”,”pwd”) &lt;br /&gt;mysql_select_db(”db1″, $db1); &lt;br /&gt;$res1 = mysql_query(”query”,$db1);$db2 = mysql_connect(”host”,”user”,”pwd”) &lt;br /&gt;mysql_select_db(”db2″, $db2); &lt;br /&gt;$res2 = mysql_query(”query”,$db2);At this point you can only fetch records from you previous ResultSet, &lt;br /&gt;i.e $res1 – But you cannot execute new query in $db1, even if you &lt;br /&gt;supply the link as because the link was overwritten by the new db.so at this point the following script will fail &lt;br /&gt;$res3 = mysql_query(”query”,$db1); //this will failSo how to solve that? &lt;br /&gt;take a look below.&lt;br /&gt;$db1 = mysql_connect(”host”,”user”,”pwd”) &lt;br /&gt;mysql_select_db(”db1″, $db1); &lt;br /&gt;$res1 = mysql_query(”query”,$db1); &lt;br /&gt;$db2 = mysql_connect(”host”,”user”,”pwd”, true)&lt;br /&gt;mysql_select_db(”db2″, $db2); &lt;br /&gt;$res2 = mysql_query(”query”,$db2); &lt;br /&gt;So mysql_connect has another optional boolean parameter which&lt;br /&gt;indicates whether a link will be created or not. as we connect to the &lt;br /&gt;$db2 with this optional parameter set to ‘true’, so both link will &lt;br /&gt;remain live. &lt;br /&gt;now the following query will execute successfully.&lt;br /&gt;$res3 = mysql_query(”query”,$db1); &lt;br /&gt;Thanks goes to Hasan and Hasin for this solution.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Q:53 List out the predefined classes in PHP?&lt;/span&gt;&lt;br /&gt;A:53 Directory &lt;br /&gt;stdClass &lt;br /&gt;__PHP_Incomplete_Class &lt;br /&gt;exception &lt;br /&gt;php_user_filter &lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Q:54 How can I make a script that can be bi-language (supports&lt;/span&gt;&lt;br /&gt;&lt;b&gt;English, German)? &lt;/b&gt;&lt;br /&gt;A:54 You can maintain two separate language file for each of the &lt;br /&gt;language. all the labels are putted in both language files as variables &lt;br /&gt;and assign those variables in the PHP source. on runtime choose the &lt;br /&gt;required language option. &lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Q:55 What are the difference between abstract class and interface?&lt;/span&gt;&lt;br /&gt;A:55 Abstract class: abstract classes are the class where one or more &lt;br /&gt;methods are abstract but not necessarily all method has to be abstract. &lt;br /&gt;Abstract methods are the methods, which are declare in its class but not &lt;br /&gt;define. The definition of those methods must be in its extending class.Interface: Interfaces are one type of class where all the methods are &lt;br /&gt;abstract. That means all the methods only declared but not defined. All &lt;br /&gt;the methods must be define by its implemented class. &lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Q:56 How can we send mail using JavaScript?&lt;/span&gt;&lt;br /&gt;A:56 JavaScript does not have any networking capabilities as it is &lt;br /&gt;designed to work on client site. As a result we can not send mails using &lt;br /&gt;JavaScript. But we can call the client side mail protocol mailto &lt;br /&gt;via JavaScript to prompt for an email to send. this requires the client &lt;br /&gt;to approve it. &lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Q:57 How can we repair a MySQL table?&lt;/span&gt;&lt;br /&gt;A:57 The syntex for repairing a MySQL table is &lt;br /&gt;REPAIR TABLENAME, [TABLENAME, ], [Quick],[Extended] &lt;br /&gt;This command will repair the table specified if the quick is given the &lt;br /&gt;MySQL will do a repair of only the index tree if the extended is given &lt;br /&gt;it will create index row by row &lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Q:58 What are the advantages of stored procedures, triggers, indexes?&lt;/span&gt;&lt;br /&gt;A:58 A stored procedure is a set of SQL commands that can be compiled and&amp;nbsp;stored in the server. Once this has been done, clients don’t need to&amp;nbsp;keep re-issuing the entire query but can refer to the stored procedure.This provides better overall performance because the query has to be&amp;nbsp;parsed only once, and less information needs to be sent between the&amp;nbsp;server and the client. You can also raise the conceptual level by having&amp;nbsp;libraries of functions in the server. However, stored procedures of&amp;nbsp;course do increase the load on the database server system, as more of&amp;nbsp;the work is done on the server side and less on the client (application)&amp;nbsp;side.Triggers will also be implemented. A trigger is effectively a type of&amp;nbsp;stored procedure, one that is invoked when a particular event occurs.&amp;nbsp;For example, you can install a stored procedure that is triggered each&amp;nbsp;time a record is deleted from a transaction table and that stored&amp;nbsp;procedure automatically deletes the corresponding customer from a&amp;nbsp;customer table when all his transactions are deleted.Indexes are used to find rows with specific column values quickly.&lt;br /&gt;Without an index, MySQL must begin with the first row and then read&amp;nbsp;through the entire table to find the relevant rows. The larger the&amp;nbsp;table, the more this costs. If the table has an index for the columns in&amp;nbsp;question, MySQL can quickly determine the position to seek to in the&amp;nbsp;middle of the data file without having to look at all the data. If a&amp;nbsp;table has 1,000 rows, this is at least 100 times faster than reading&amp;nbsp;sequentially. If you need to access most of the rows, it is faster to&amp;nbsp;read sequentially, because this minimizes disk seeks.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Q:59 What is the maximum length of a table name, database name, and&lt;/span&gt;&lt;br /&gt;&lt;b&gt;fieldname in MySQL? &lt;/b&gt;&lt;br /&gt;A:59 The following table describes the maximum length for each type of&amp;nbsp;identifier.&lt;br /&gt;Identifier Maximum Length&lt;br /&gt;(bytes) &lt;br /&gt;Database 64 &lt;br /&gt;Table 64 &lt;br /&gt;Column 64 &lt;br /&gt;Index 64 &lt;br /&gt;Alias 255 &lt;br /&gt;There are some restrictions on the characters that may appear in&amp;nbsp;identifiers:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Q:60 How many values can the SET function of MySQL take?&lt;/span&gt;&lt;br /&gt;A:60 MySQL set can take zero or more values but at the maximum it can &lt;br /&gt;take 64 values &lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Q:61 What are the other commands to know the structure of table using&lt;/span&gt;&lt;br /&gt;MySQL commands except explain command? &lt;br /&gt;A:61 describe Table-Name; &lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Q:62 How many tables will create when we create table, what are they?&lt;/span&gt;&lt;br /&gt;A:62 The ‘.frm’ file stores the table definition. &lt;br /&gt;The data file has a ‘.MYD’ (MYData) extension. &lt;br /&gt;The index file has a ‘.MYI’ (MYIndex) extension, &lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Q:63 What is the purpose of the following files having extensions 1) .frm&lt;/span&gt;&lt;br /&gt;&lt;b&gt;2) .myd 3) .myi? What do these files contain? &lt;/b&gt;&lt;br /&gt;A:63 In MySql, the default table type is MyISAM. &lt;br /&gt;Each MyISAM table is stored on disk in three files. The files have names&amp;nbsp;that begin with the table name and have an extension to indicate the&amp;nbsp;file type.&lt;br /&gt;The ‘.frm’ file stores the table definition. &lt;br /&gt;The data file has a ‘.MYD’ (MYData) extension. &lt;br /&gt;The index file has a ‘.MYI’ (MYIndex) extension, &lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Q:64 What is maximum size of a database in MySQL?&lt;/span&gt;&lt;br /&gt;A:64 If the operating system or filesystem places a limit on the number &lt;br /&gt;of files in a directory, MySQL is bound by that constraint.The efficiency of the operating system in handling large numbers of &lt;br /&gt;files in a directory can place a practical limit on the number of tables&amp;nbsp;in a database. If the time required to open a file in the directory&amp;nbsp;increases significantly as the number of files increases, database&lt;br /&gt;performance can be adversely affected.&amp;nbsp;The amount of available disk space limits the number of tables.&lt;br /&gt;MySQL 3.22 had a 4GB (4 gigabyte) limit on table size. With the MyISAM&amp;nbsp;storage engine in MySQL 3.23, the maximum table size was increased to&amp;nbsp;65536 terabytes (2567 – 1 bytes). With this larger allowed table size,&amp;nbsp;the maximum effective table size for MySQL databases is usually&amp;nbsp;determined by operating system constraints on file sizes, not by MySQL&amp;nbsp;internal limits.The InnoDB storage engine maintains InnoDB tables within a tablespace&amp;nbsp;that can be created from several files. This allows a table to exceed&amp;nbsp;the maximum individual file size. The tablespace can include raw disk&amp;nbsp;partitions, which allows extremely large tables. The maximum tablespace&amp;nbsp;size is 64TB.&lt;br /&gt;The following table lists some examples of operating system file-size&amp;nbsp;limits. This is only a rough guide and is not intended to be definitive.&amp;nbsp;For the most up-to-date information, be sure to check the documentation&lt;br /&gt;specific to your operating system.&lt;br /&gt;Operating System File-size LimitLinux 2.2-Intel 32-bit 2GB (LFS: 4GB) &lt;br /&gt;Linux 2.4+ (using ext3 filesystem) 4TB &lt;br /&gt;Solaris 9/10 16TB &lt;br /&gt;NetWare w/NSS filesystem 8TB &lt;br /&gt;Win32 w/ FAT/FAT32 2GB/4GB &lt;br /&gt;Win32 w/ NTFS 2TB (possibly larger) &lt;br /&gt;MacOS X w/ HFS+ 2TB &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Q:65 Give the syntax of Grant and Revoke commands? &lt;br /&gt;&lt;/strong&gt;A:65 The generic syntax for grant is as following &lt;br /&gt;&amp;gt; GRANT [rights] on [database/s] TO [username@hostname] IDENTIFIED BY &lt;br /&gt;[password] now rights can be &lt;br /&gt;a) All privileges &lt;br /&gt;b) combination of create, drop, select, insert, update and delete etc.We can grant rights on all databse by using *.* or some specific&amp;nbsp;database by database.* or a specific table by database.table_name&lt;br /&gt;username@hotsname can be either username@localhost, username@hostname&amp;nbsp;and username@%&lt;br /&gt;where hostname is any valid hostname and % represents any name, the *.*&amp;nbsp;any condition&amp;nbsp;password is simply the password of userThe generic syntax for revoke is as following &amp;nbsp;&amp;gt; REVOKE [rights] on [database/s] FROM [username@hostname]&amp;nbsp;now rights can be as explained above&lt;br /&gt;a) All privileges &lt;br /&gt;b) combination of create, drop, select, insert, update and delete etc. &lt;a href="mailto:username@hotsname"&gt;username@hotsname&lt;/a&gt; can be either username@localhost, username@hostname &lt;br /&gt;and username@%  where hostname is any valid hostname and % represents any name, the *.*  any condition &lt;br /&gt;&lt;strong&gt;Q:66 Explain Normalization concept? &lt;/strong&gt; &lt;br /&gt;A:66 The normalization process involves getting our data to conform to &lt;br /&gt;three progressive normal forms, and a higher level of normalization  cannot be achieved until the previous levels have been achieved (there  are actually five normal forms, but the last two are mainly academic and  will not be discussed).First Normal FormThe First Normal Form (or 1NF) involves removal of redundant data  from horizontal rows. We want to ensure that there is no duplication of  data in a given row, and that every column stores the least amount of  information possible (making the field atomic).Second Normal FormWhere the First Normal Form deals with redundancy of data across a  horizontal row, Second Normal Form (or 2NF) deals with redundancy of  data in vertical columns. As stated earlier, the normal forms are  progressive, so to achieve Second Normal Form, your tables must already  be in First Normal Form.Third Normal Form &lt;br /&gt;I have a confession to make; I do not often use Third Normal Form. In  Third Normal Form we are looking for data in our tables that is not  fully dependant on the primary key, but dependant on another value in  the table &lt;br /&gt;&lt;strong&gt;Q:67 How can we find the number of rows in a table using MySQL? &lt;br /&gt;&lt;/strong&gt;A:67 Use this for mysql &lt;br /&gt;&amp;gt;SELECT COUNT(*) FROM table_name; &lt;br /&gt;&lt;strong&gt;Q:68 How can we find the number of rows in a result set using PHP? &lt;br /&gt;&lt;/strong&gt;A:68 $result = mysql_query($sql, $db_link); &lt;br /&gt;$num_rows = mysql_num_rows($result); &lt;br /&gt;echo "$num_rows rows found"; &lt;br /&gt;&lt;strong&gt;Q:69 How many ways we can we find the current date using MySQL? &lt;br /&gt;&lt;/strong&gt;A:69 SELECT CURDATE(); &lt;br /&gt;CURRENT_DATE() = CURDATE() &lt;br /&gt;for time use &lt;br /&gt;SELECT CURTIME(); &lt;br /&gt;CURRENT_TIME() = CURTIME() &lt;br /&gt;&lt;strong&gt;Q:70 What are the advantages and disadvantages of Cascading Style Sheets?&lt;/strong&gt; &lt;br /&gt;A:70 External Style SheetsAdvantagesCan control styles for multiple documents at once.Classes can be created for use on multiple HTML element types in many documents. Selector and grouping methods can be used to apply styles under complex contextsDisadvantagesAn extra download is required to import style information for each document The rendering of the document may be delayed until the external style sheet is loaded Becomes slightly unwieldy for small quantities of style definitions &lt;br /&gt;Embedded Style Sheets &lt;br /&gt;Advantages &lt;br /&gt;Classes can be created for use on multiple tag types in the document. Selector and grouping methods can be used to apply styles under complex contexts. No additional downloads necessary to receive style information &lt;br /&gt;Disadvantages &lt;br /&gt;This method can not control styles for multiple documents at once Inline Styles &lt;br /&gt;Advantages &lt;br /&gt;Useful for small quantities of style definitions. Can override other style specification methods at the local level so only exceptions need to be listed in conjunction with other style methods &lt;br /&gt;Disadvantages &lt;br /&gt;Does not distance style information from content (a main goal of SGML/HTML). Can not control styles for multiple documents at once. Author can not create or control classes of elements to control multiple element types within the document. Selector grouping methods can not be used to create complex element addressing scenarios &lt;br /&gt;&lt;strong&gt;Q:71 What type of inheritance that PHP supports?&lt;/strong&gt; &lt;br /&gt;A:71 In PHP an extended class is always dependent on a single base class, that is, multiple inheritance is not supported. Classes are extended using the keyword ‘extends’. &lt;br /&gt;&lt;strong&gt;Q:72 What is the difference between Primary Key and Unique key?&lt;/strong&gt; &lt;br /&gt;A:72 Primary Key: A column in a table whose values uniquely identify the rows in the table. A primary key value cannot be NULL. &lt;br /&gt;Unique Key: Unique Keys are used to uniquely identify each row in the table. There can be one and only one row for each unique key value. So NULL can be a unique key.There can be only one primary key for a table but there can be more than one unique for a table. &lt;br /&gt;&lt;strong&gt;Q:73 The structure of table view buyers is as follows: &lt;br /&gt;Field Type Null Key Default Extra user_pri_id int(15) PRI null auto_increment userid varchar(10) YES null the value of user_pri_id the last row 999 then What will happen in the following conditions? &lt;/strong&gt; &lt;br /&gt;&lt;b&gt;Condition1:&lt;/b&gt; Delete all the rows and insert another row then. What is the starting value for this auto incremented field user_pri_id ,&lt;br /&gt;&lt;b&gt;Condition2:&lt;/b&gt; Delete the last row(having the field value 999) and insert another row then. What is the value for this auto incremented field user_pri_id &lt;br /&gt;A:73 In both cases let the value for auto increment field be n then next &lt;br /&gt;row will have value n+1 i.e. 1000 &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Q:74 What are the advantages/disadvantages of MySQL and PHP?&lt;/strong&gt; &lt;br /&gt;A:74 Both of them are open source software (so free of cost), support cross platform. php is faster then ASP and JSP. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Q:75 What is the difference between GROUP BY and ORDER BY in Sql?&lt;/strong&gt; &lt;br /&gt;A:75 ORDER BY [col1],[col2],…,[coln]; Tels DBMS according to what columns it should sort the result. If two rows will hawe the same value in col1 it will try to sort them according to col2 and so on.GROUP BY [col1],[col2],…,[coln]; Tels DBMS to group results with same value of column col1. You can use COUNT(col1), SUM(col1), AVG(col1) with it, if you want to count all items in group, sum all values or view average &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Q:76 What is the difference between char and varchar data types?&lt;/strong&gt; &lt;br /&gt;A:76 Set char to occupy n bytes and it will take n bytes even if u r storing a value of n-m bytes Set varchar to occupy n bytes and it will take only the required space and will not use the n bytes &lt;br /&gt;eg. name char(15) will waste 10 bytes if we store ‘mizan’, if each char &lt;br /&gt;takes a byte eg. name varchar(15) will just use 5 bytes if we store ‘mizan’, if each &lt;br /&gt;char takes a byte. rest 10 bytes will be free. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Q:77 What is the functionality of md5 function in PHP?&lt;/strong&gt; &lt;br /&gt;A:77 Calculate the md5 hash of a string. The hash is a 32-character hexadecimal number. I use it to generate keys which I use to identify users etc. If I add random no techniques to it the md5 generated now will be totally different for the same string I am using. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Q:78 How can I load data from a text file into a table?&lt;/strong&gt; &lt;br /&gt;A:78 you can use LOAD DATA INFILE file_name; syntax to load data from a text file. but you have to make sure thata) data is delimited  b) columns and data matched correctly &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Q:79 How can we know the number of days between two given dates using &lt;br /&gt;MySQL?&lt;/strong&gt; &lt;br /&gt;A:79 SELECT DATEDIFF(’2007-03-07′,’2005-01-01′); &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;How can we know the number of days between two given dates using &lt;br /&gt;PHP?&lt;/strong&gt; &lt;br /&gt;A:80 $date1 = date(’Y-m-d’); &lt;br /&gt;$date2 = ‘2006-08-15′; &lt;br /&gt;$days = (strtotime($date1) – strtotime($date2)) / (60 * 60 * 24);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-6989203443107281804?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/6989203443107281804/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2009/08/php-mysql-interview-questions-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/6989203443107281804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/6989203443107281804'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2009/08/php-mysql-interview-questions-and.html' title='PHP Mysql Interview Questions and Answers'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-2250380546042384796</id><published>2009-08-18T20:11:00.000+05:30</published><updated>2009-08-18T20:15:22.604+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='interview questions'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='php interview questions and answers'/><title type='text'>PHP Interview Questions and Answers</title><content type='html'>&lt;span style="font-weight: bold; font-family: arial;"&gt;1. What does a special set of tags  do in PHP?&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: arial;"&gt; The output is displayed directly to the browser.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span style="font-weight: bold; font-family: arial;"&gt;2. What’s the difference between include and require? &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;It’s how they handle failures. If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span style="font-weight: bold; font-family: arial;"&gt;3. I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what’s the problem? &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt; PHP Interpreter treats numbers beginning with 0 as octal. Look at the similar PHP interview questions for more numeric problems.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span style="font-weight: bold; font-family: arial;"&gt;4. Would I use print "$a dollars" or "{$a} dollars" to print out the amount of dollars in this example?&lt;/span&gt; &lt;br /&gt;&lt;span style="font-family: arial;"&gt; In this example it wouldn’t matter, since the variable is all by itself, but if you were to print something like "{$a},000,000 mln dollars", then you definitely need to use the braces.&lt;/span&gt;&lt;br /&gt;   &lt;br /&gt;&lt;span style="font-weight: bold; font-family: arial;"&gt;5. How do you define a constant?&lt;/span&gt;&lt;span style="font-family: arial;"&gt; - Via define() directive, like define ("MYCONSTANT", 100);&lt;/span&gt;&lt;br /&gt;   &lt;br /&gt;&lt;span style="font-weight: bold; font-family: arial;"&gt;6. How do you pass a variable by value?&lt;/span&gt;&lt;span style="font-family: arial;"&gt; - Just like in C++, put an ampersand in front of it, like $a = &amp;amp;$b&lt;/span&gt;&lt;br /&gt;   &lt;br /&gt;&lt;span style="font-weight: bold; font-family: arial;"&gt;7. Will comparison of string "10" and integer 11 work in PHP?&lt;/span&gt;&lt;span style="font-family: arial;"&gt; - Yes, internally PHP will cast everything to the integer type, so numbers 10 and 11 will be compared.&lt;/span&gt;&lt;br /&gt;   &lt;br /&gt;&lt;span style="font-weight: bold; font-family: arial;"&gt;8. When are you supposed to use endif to end the conditional statement?&lt;/span&gt;&lt;span style="font-family: arial;"&gt; - When the original if was followed by : and then the code block without braces.&lt;/span&gt;&lt;br /&gt;   &lt;br /&gt;&lt;span style="font-weight: bold; font-family: arial;"&gt;9. Explain the ternary conditional operator in PHP?&lt;/span&gt;&lt;span style="font-family: arial;"&gt; - Expression preceding the ? is evaluated, if it’s true, then the expression preceding the : is executed, otherwise, the expression following : is executed.&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="font-weight: bold; font-family: arial;"&gt;10. How do I find out the number of parameters passed into function?&lt;/span&gt;&lt;span style="font-family: arial;"&gt; - func_num_args() function returns the number of parameters passed in.&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="font-weight: bold; font-family: arial;"&gt;11. If the variable $a is equal to 5 and variable $b is equal to character a, what’s the value of $$b?&lt;/span&gt;&lt;span style="font-family: arial;"&gt; - 100, it’s a reference to existing variable.&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="font-weight: bold; font-family: arial;"&gt;12. What’s the difference between accessing a class method via -&gt; and via ::?&lt;/span&gt;&lt;span style="font-family: arial;"&gt; - :: is allowed to access methods that can perform static operations, i.e. those, which do not require object initialization.&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="font-weight: bold; font-family: arial;"&gt;13. Are objects passed by value or by reference?&lt;/span&gt;&lt;span style="font-family: arial;"&gt; - Everything is passed by value.&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="font-weight: bold; font-family: arial;"&gt;14. How do you call a constructor for a parent class?&lt;/span&gt;&lt;span style="font-family: arial;"&gt; - parent::constructor($value)&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="font-weight: bold; font-family: arial;"&gt;15. What’s the special meaning of __sleep and __wakeup? &lt;/span&gt;&lt;span style="font-family: arial;"&gt;- __sleep returns the array of all the variables than need to be saved, while __wakeup retrieves them.&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="font-weight: bold; font-family: arial;"&gt;16. Why doesn’t the following code print the newline properly?    &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;      Because inside the single quotes the n character is not interpreted as newline, just as a sequence of two characters - and n.&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="font-weight: bold; font-family: arial;"&gt;17. Would you initialize your strings with single quotes or double quotes?&lt;/span&gt;&lt;span style="font-family: arial;"&gt; - Since the data inside the single-quoted string is not parsed for variable substitution, it’s always a better idea speed-wise to initialize a string with single quotes, unless you specifically need variable substitution.&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="font-weight: bold; font-family: arial;"&gt;18. How come the code  works, but  doesn’t for two-dimensional array of mine?&lt;/span&gt;&lt;span style="font-family: arial;"&gt; - Any time you have an array with more than one dimension, complex parsing syntax is required. print "Contents: {$arr[1][2]}" would’ve worked.&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="font-weight: bold; font-family: arial;"&gt;19. What is the difference between characters �23 and x23?&lt;/span&gt;&lt;span style="font-family: arial;"&gt; - The first one is octal 23, the second is hex 23.&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="font-weight: bold; font-family: arial;"&gt;20. With a heredoc syntax, do I get variable substitution inside the heredoc contents? &lt;/span&gt;&lt;span style="font-family: arial;"&gt;- Yes.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-2250380546042384796?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/2250380546042384796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2009/08/php-interview-questions-and-answers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/2250380546042384796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/2250380546042384796'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2009/08/php-interview-questions-and-answers.html' title='PHP Interview Questions and Answers'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-3962007335066435851</id><published>2009-06-30T16:41:00.000+05:30</published><updated>2009-06-30T16:47:49.262+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='post'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='php ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='jsp'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='get'/><title type='text'>Using GET and POST method in XMLHTTPRequest(Ajax) PHP Java Jsp</title><content type='html'>&lt;p&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;Requirements&lt;/strong&gt;&lt;br /&gt;Create a XMLHTTPRequest Object that uses the POST method.var http = new XMLHttpRequest();&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;Using GET method&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;Now we open a connection using the GET method.var url = "get_data.php";&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;var params = "lorem=ipsum&amp;amp;name=binny";&lt;br /&gt;http.open("GET“, url+”?”+params, true);&lt;br /&gt;http.onreadystatechange = function() {&lt;br /&gt;//Call a function when the state changes.&lt;br /&gt;if(http.readyState == 4 &amp;amp;&amp;amp; http.status == 200) {&lt;br /&gt;alert(http.responseText);}}&lt;br /&gt;http.send(null);&lt;/span&gt;&lt;br /&gt;I really hope that this much is clear for you&lt;br /&gt;&lt;strong&gt;POST method&lt;br /&gt;&lt;/strong&gt;We are going to make some modifications so POST method will be used when sending the request…&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-family:courier new;"&gt;var url = "get_data.php";&lt;br /&gt;var params = "lorem=ipsum&amp;amp;name=binny";&lt;br /&gt;http.open("POST“, url, true);&lt;br /&gt;//Send the proper header information along with the request&lt;br /&gt;http.setRequestHeader(”Content-type”, “application/x-www-form-urlencoded”);&lt;br /&gt;http.setRequestHeader(”Content-length”, params.length);&lt;br /&gt;http.setRequestHeader(”Connection”, “close”);&lt;br /&gt;http.onreadystatechange = function() {&lt;br /&gt;//Call a function when the state changes.&lt;br /&gt;if(http.readyState == 4 &amp;amp;&amp;amp; http.status == 200) {&lt;br /&gt;alert(http.responseText);}}&lt;br /&gt;http.send(params);&lt;br /&gt;&lt;/span&gt;The first change(and the most obvious one) is that I changed the first argument of the open function from GET to POST. Also notice the difference in the second argument – in the GET method, we send the parameters along with the url separated by a ‘?’ character…http.open("GET",url+”?”+params, true);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;But in the POST method we will use just the url as the second argument. We will send the parameters later.http.open("POST", url, true);&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;Some http headers must be set along with any POST request. So we set them in these lines…http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");&lt;br /&gt;http.setRequestHeader("Content-length", params.length);&lt;br /&gt;http.setRequestHeader("Connection", "close");&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;With the above lines we are basically saying that the data send is in the format of a form submission. We also give the length of the parameters we are sending.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;http.onreadystatechange = function() {&lt;br /&gt;//Call a function when the state changes.&lt;br /&gt;if(http.readyState == 4 &amp;amp;&amp;amp; http.status == 200) {&lt;br /&gt;alert(http.responseText);}} &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;We set a handler for the ‘ready state’ change event. This is the same handler we used for the GET method. You can use the http.responseText here – insert into a div using innerHTML(AHAH), eval it(JSON) or anything else.&lt;br /&gt;http.send(params);&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-3962007335066435851?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/3962007335066435851/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2009/06/using-get-and-post-method-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/3962007335066435851'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/3962007335066435851'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2009/06/using-get-and-post-method-in.html' title='Using GET and POST method in XMLHTTPRequest(Ajax) PHP Java Jsp'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-6277104735453435023</id><published>2009-06-27T11:27:00.000+05:30</published><updated>2009-06-27T11:34:42.451+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='jsp'/><category scheme='http://www.blogger.com/atom/ns#' term='syntax in jsp'/><category scheme='http://www.blogger.com/atom/ns#' term='syntax'/><title type='text'>Syntax in jsp</title><content type='html'>&lt;span style="font-size:100%;"&gt;&lt;span style="font-family: verdana;"&gt;Legend All tags are case sensitive. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;A pair of single quotes is equivalent to a pair of double quotes.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;Spaces are not allowed between an equals sign and an attribute value.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;plain text = required bold = default italics = user-defined | = or&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;[ ] = optional { } = required choice ... = list of items + = can repeat &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;HTML Comment Creates a comment that is sent to the client in the viewable page source.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-family: verdana;"&gt;Hidden Comment &lt;/span&gt;&lt;span style="font-family: verdana;"&gt;Documents the JSP file, but is not sent to the client.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;&lt;%-- comment --%&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-family: verdana;"&gt;Declaration &lt;/span&gt;&lt;span style="font-family: verdana;"&gt;Declares variables or methods valid in the page scripting language.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;&lt;%! declaration; [ declaration; ]+ ... %&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-family: verdana;"&gt;Expression &lt;/span&gt;&lt;span style="font-family: verdana;"&gt;Contains an expression valid in the page scripting language.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;&lt;%= expression %&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-family: verdana;"&gt;Scriptlet &lt;/span&gt;&lt;span style="font-family: verdana;"&gt;Contains a code fragment valid in the page scripting language.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;&lt;% code fragment of one or more lines %&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-family: verdana;"&gt;Include Directive&lt;/span&gt;&lt;span style="font-family: verdana;"&gt; Includes a static file, parsing the file’s&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;JSP elements.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;&lt;%@ include file="relativeURL" %&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-family: verdana;"&gt;Page Directive&lt;/span&gt;&lt;span style="font-family: verdana;"&gt; Defines attributes that apply to an entire JSP page.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;&lt;%@ page [ language="java" ] [ extends="package.class" ] [ import="{package.class | package.*} , ... " ] [ session="true|false" ] [ buffer="none|8kb|sizekb" ] [ autoFlush="true|false" ] [ isThreadSafe="true|false" ] [ info="text" ] [ errorPage="relativeURL" ] [ contentType="{mimeType [ ; charset=characterSet ] | text/html ; charset=ISO-8859-1}" ] [ isErrorPage="true|false" ] %&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-family: verdana;"&gt;Taglib Directive&lt;/span&gt;&lt;span style="font-family: verdana;"&gt; Defines a tag library and prefix for the custom tags used in the JSP page.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: verdana;"&gt;&lt;%@ taglib uri="URIToTagLibrary" prefix="tagPrefix" %&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;tagprefix:name style="font-family: verdana;"&gt; &lt;span style="font-weight: bold;"&gt;Accesses&lt;/span&gt; a custom tag’s functionality. &lt;tagprefix:name attribute="value"&gt;&lt;tagprefix:name attribute="value"&gt;other tags and data&lt;br /&gt;&lt;jsp:forward&gt; Forwards a client request to an HTML&lt;br /&gt;file, JSP file, or servlet for processing.&lt;br /&gt;&lt;jsp:forward page=""&gt; }"&lt;br /&gt;{ /&gt; |&lt;br /&gt;&gt; [ &lt;jsp:param name="parameterName" value=""&gt;}" /&gt; ]+&lt;br /&gt;&lt;/jsp:forward&gt; }&lt;br /&gt;&lt;br /&gt;&lt;jsp:getproperty&gt; Gets the value of a bean property so that&lt;br /&gt;you can display it in a result page.&lt;br /&gt;&lt;br /&gt;&lt;jsp:getproperty name="beanInstanceName" property="propertyName"&gt;&lt;br /&gt;&lt;jsp:include&gt; Includes a static file or sends a request to a dynamic file.&lt;br /&gt;&lt;jsp:include page=""&gt;}" flush="true"&lt;br /&gt;{ /&gt; |&lt;br /&gt;&gt; [ &lt;jsp:param name="parameterName" value=""&gt;}" /&gt; ]+&lt;br /&gt;&lt;/jsp:include&gt; }&lt;br /&gt;&lt;br /&gt;&lt;jsp:plugin&gt; Downloads plug-in software to the Web&lt;br /&gt;browser to execute an applet or bean.&lt;br /&gt;&lt;jsp:plugin type="bean|applet" code="classFileName" codebase="classFileDirectoryName"&lt;br /&gt;[ name="instanceName" ] [ archive="URIToArchive, ..." ] [ align="bottom|top|middle|left|right" ]&lt;br /&gt;[ height="displayPixels" ] [ width="displayPixels" ] [ hspace="leftRightPixels" ] [ vspace="topBottomPixels" ]&lt;br /&gt;[ jreversion="JREVersionNumber | 1.1" ] [ nspluginurl="URLToPlugin" ] [ iepluginurl="URLToPlugin" ] &gt;&lt;br /&gt;[ &lt;jsp:params&gt; [ &lt;jsp:param name="parameterName" value=""&gt;}" /&gt; ]+&lt;br /&gt;&lt;/jsp:params&gt; ]&lt;br /&gt;[ &lt;jsp:fallback&gt; text message for user &lt;/jsp:fallback&gt; ]&lt;br /&gt;&lt;/jsp:plugin&gt;&lt;br /&gt;&lt;jsp:setproperty&gt; Sets a property value or values in a&lt;br /&gt;bean.&lt;br /&gt;&lt;jsp:setProperty name="beanInstanceName"&lt;br /&gt;{ property="*" | property="propertyName" [ param="parameterName" ] |&lt;br /&gt;property="propertyName" value="{string | &lt;%= expression %&gt;}" } /&gt;&lt;br /&gt;&lt;jsp:usebean&gt; Locates or instantiates a bean with a&lt;br /&gt;specific name and scope.&lt;br /&gt;&lt;jsp:useBean id="beanInstanceName" scope="page|request|session|application"&lt;br /&gt;{ class="package.class" [ type="package.class" ] | type="package.class" |&lt;br /&gt;beanName="{package.class | &lt;%= expression %&gt;}" type="package.class" }&lt;br /&gt;{ /&gt; | &gt; other elements &lt;/jsp:useBean&gt; }&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Implicit Objects&lt;/span&gt; Type Scope Some Useful Methods (see class or interface for others)&lt;br /&gt;request Subclass of javax.servlet.ServletRequest Request getAttribute, getParameter, getParameterNames, getParameterValues, setAttribute&lt;br /&gt;response Subclass of javax.servlet.ServletResponse Page Not typically used by JSP page authors&lt;br /&gt;pageContext javax.servlet.jsp.PageContext Page findAttribute, getAttribute, getAttributesScope, getAttributeNamesInScope, setAttribute&lt;br /&gt;&lt;br /&gt;session javax.servlet.http.HttpSession Session getAttribute, getId, setAttribute&lt;br /&gt;application javax.servlet.ServletContext Application getAttribute, getMimeType, getRealPath, setAttribute&lt;br /&gt;&lt;br /&gt;out javax.servlet.jsp.JspWriter Page clear, clearBuffer, flush, getBufferSize, getRemaining&lt;br /&gt;config javax.servlet.ServletConfig Page getInitParameter, getInitParameterNames&lt;br /&gt;page java.lang.Object Page Not typically used by JSP page authors&lt;br /&gt;exception java.lang.Throwable Page getMessage, getLocalizedMessage, printStackTrace, toString&lt;br /&gt;&lt;/tagprefix:name&gt;&lt;/tagprefix:name&gt;&lt;/tagprefix:name&gt;&lt;/span&gt;&lt;!-- comment [ &lt;%= expression %&gt; ] --&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-6277104735453435023?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/6277104735453435023/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2009/06/syntax-in-jsp.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/6277104735453435023'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/6277104735453435023'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2009/06/syntax-in-jsp.html' title='Syntax in jsp'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-4774597364663453759</id><published>2009-06-11T10:30:00.000+05:30</published><updated>2009-06-11T10:33:00.392+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='operator'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='reference'/><category scheme='http://www.blogger.com/atom/ns#' term='function reference'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='Function arguments'/><title type='text'>Operator and Function Reference in mysql</title><content type='html'>&lt;div class="titlepage"&gt; &lt;div&gt; &lt;div&gt; &lt;h2 style="CLEAR: both" class="title"&gt; Operator and Function Reference&lt;/h2&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt; &lt;div class="informaltable"&gt; &lt;table border="1"&gt; &lt;colgroup&gt; &lt;col&gt; &lt;col&gt;&lt;/colgroup&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;&lt;span class="bold"&gt;&lt;strong&gt;Name&lt;/strong&gt;&lt;/span&gt;&lt;/th&gt; &lt;th&gt;&lt;span class="bold"&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/span&gt;&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;ABS()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the absolute value&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;ACOS()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the arc cosine&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;ADDDATE()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Add dates&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;ADDTIME()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Add time&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;AES_DECRYPT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Decrypt using AES&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;AES_ENCRYPT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Encrypt using AES&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;AND&lt;/code&gt;, &lt;code class="literal"&gt;&amp;amp;&amp;amp;&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Logical AND&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;ASCII()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return numeric value of left-most character&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;ASIN()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the arc sine&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;ATAN2()&lt;/code&gt;,  &lt;code class="literal"&gt;ATAN()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the arc tangent of the two arguments&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;ATAN()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the arc tangent&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;AVG()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the average value of the argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;BENCHMARK()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Repeatedly execute an expression&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;BETWEEN ... AND  ... &lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Check whether a value is within a range of values&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;BIN()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return a string representation of the argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;BINARY&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Cast a string to a binary string&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;BIT_AND()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return bitwise and&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;BIT_COUNT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the number of bits that are set&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;BIT_LENGTH()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return length of argument in bits&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;BIT_OR()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return bitwise or&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;BIT_XOR()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Return bitwise xor&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;&amp;amp;&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Bitwise AND&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;~&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Invert bits&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;|&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Bitwise OR&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;^&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Bitwise XOR&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;CASE&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Case operator&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;CAST()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Cast a value as a certain type&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;CEIL()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the smallest integer value not less than the argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;CEILING()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the smallest integer value not less than the argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;CHAR_LENGTH()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return number of characters in argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;CHAR()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the character for each integer passed&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;CHARACTER_LENGTH()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;A synonym for CHAR_LENGTH()&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;CHARSET()&lt;/code&gt;&lt;/a&gt;(v4.1.0)&lt;/td&gt; &lt;td&gt;Return the character set of the argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;COALESCE()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the first non-NULL argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;COERCIBILITY()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Return the collation coercibility value of the string argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;COLLATION()&lt;/code&gt;&lt;/a&gt;(v4.1.0)&lt;/td&gt; &lt;td&gt;Return the collation of the string argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;COMPRESS()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Return result as a binary string&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;CONCAT_WS()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return concatenate with separator&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;CONCAT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return concatenated string&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;CONNECTION_ID()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the connection ID (thread ID) for the connection&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;CONV()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Convert numbers between different number bases&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;CONVERT_TZ()&lt;/code&gt;&lt;/a&gt;(v4.1.3)&lt;/td&gt; &lt;td&gt;Convert from one timezone to another&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;Convert()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Cast a value as a certain type&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;COS()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the cosine&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;COT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the cotangent&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;COUNT(DISTINCT)&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the count of a number of different values&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;COUNT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return a count of the number of rows returned&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;CRC32()&lt;/code&gt;&lt;/a&gt;(v4.1.0)&lt;/td&gt; &lt;td&gt;Compute a cyclic redundancy check value&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;CURDATE()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the current date&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;CURRENT_DATE()&lt;/code&gt;, &lt;code class="literal"&gt;CURRENT_DATE&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Synonyms for CURDATE()&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;CURRENT_TIME()&lt;/code&gt;, &lt;code class="literal"&gt;CURRENT_TIME&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Synonyms for CURTIME()&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;CURRENT_TIMESTAMP()&lt;/code&gt;, &lt;code class="literal"&gt;CURRENT_TIMESTAMP&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Synonyms for NOW()&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;CURRENT_USER()&lt;/code&gt;, &lt;code class="literal"&gt;CURRENT_USER&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the username and hostname combination&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;CURTIME()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the current time&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;DATABASE()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the default (current) database name&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;DATE_ADD()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Add two dates&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;DATE_FORMAT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Format date as specified&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;DATE_SUB()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Subtract two dates&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;DATE()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Extract the date part of a date or datetime expression&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;DATEDIFF()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Subtract two dates&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;DAY()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Synonym for DAYOFMONTH()&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;DAYNAME()&lt;/code&gt;&lt;/a&gt;(v4.1.21)&lt;/td&gt; &lt;td&gt;Return the name of the weekday&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;DAYOFMONTH()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the day of the month (0-31)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;DAYOFWEEK()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the weekday index of the argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;DAYOFYEAR()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the day of the year (1-366)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;DECODE()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Decodes a string encrypted using ENCODE()&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;DEFAULT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the default value for a table column&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;DEGREES()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Convert radians to degrees&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;DES_DECRYPT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Decrypt a string&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;DES_ENCRYPT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Encrypt a string&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;DIV&lt;/code&gt;&lt;/a&gt;(v4.1.0)&lt;/td&gt; &lt;td&gt;Integer division&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;/&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Division operator&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;ELT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return string at index number&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;ENCODE()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Encode a string&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;ENCRYPT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Encrypt a string&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;&lt;=&gt;&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;NULL-safe equal to operator&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;=&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Equal operator&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;EXP()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Raise to the power of&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;EXPORT_SET()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return a string such that for every bit set in the value bits, you get an on  string and for every unset bit, you get an off string&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;EXTRACT&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Extract part of a date&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;ExtractValue()&lt;/code&gt;&lt;/a&gt;(v5.1.5)&lt;/td&gt; &lt;td&gt;Extracts a value from an XML string using XPath notation&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;FIELD()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the index (position) of the first argument in the subsequent  arguments&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;FIND_IN_SET()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the index position of the first argument within the second  argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;FLOOR()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the largest integer value not greater than the argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;FORMAT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return a number formatted to specified number of decimal places&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;FOUND_ROWS()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;For a SELECT with a LIMIT clause, the number of rows that would be returned  were there no LIMIT clause&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;FROM_DAYS()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Convert a day number to a date&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;FROM_UNIXTIME()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Format UNIX timestamp as a date&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;GET_FORMAT()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Return a date format string&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;GET_LOCK()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Get a named lock&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;&gt;=&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Greater than or equal operator&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;&gt;&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Greater than operator&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;GREATEST()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the largest argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;GROUP_CONCAT()&lt;/code&gt;&lt;/a&gt;(v4.1)&lt;/td&gt; &lt;td&gt;Return a concatenated string&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;HEX()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return a hexadecimal representation of a decimal or string value&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;HOUR()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Extract the hour&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;IF()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;If/else construct&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;IFNULL()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Null if/else construct&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;IN()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Check whether a value is within a set of values&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;INET_ATON()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the numeric value of an IP address&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;INET_NTOA()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the IP address from a numeric value&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;INSERT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Insert a substring at the specified position up to the specified number of  characters&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;INSTR()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the index of the first occurrence of substring&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;INTERVAL()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the index of the argument that is less than the first  argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;IS_FREE_LOCK()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Checks whether the named lock is free&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;IS NOT  NULL&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;NOT NULL value test&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;IS  NOT&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Test a value against a boolean&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;IS  NULL&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;NULL value test&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;IS_USED_LOCK()&lt;/code&gt;&lt;/a&gt;(v4.1.0)&lt;/td&gt; &lt;td&gt;Checks whether the named lock is in use. Return connection identifier if  true.&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;IS&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Test a value against a boolean&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;ISNULL()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Test whether the argument is NULL&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;LAST_DAY&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Return the last day of the month for the argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;LAST_INSERT_ID()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Value of the AUTOINCREMENT column for the last INSERT&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;LCASE()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Synonym for LOWER() &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;LEAST()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the smallest argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;&lt;&lt;&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Left shift&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;LEFT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the leftmost number of characters as specified&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;LENGTH()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the length of a string in bytes&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;&lt;=&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Less than or equal operator&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;&lt;&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Less than operator&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;LIKE&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Simple pattern matching&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;LN()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the natural logarithm of the argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;LOAD_FILE()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Load the named file&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;LOCALTIME()&lt;/code&gt;, &lt;code class="literal"&gt;LOCALTIME&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Synonym for NOW()&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;LOCALTIMESTAMP&lt;/code&gt;, &lt;code class="literal"&gt;LOCALTIMESTAMP()&lt;/code&gt;&lt;/a&gt;(v4.0.6)&lt;/td&gt; &lt;td&gt;Synonym for NOW()&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;LOCATE()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the position of the first occurrence of substring&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;LOG10()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the base-10 logarithm of the argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;LOG2()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the base-2 logarithm of the argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;LOG()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the natural logarithm of the first argument &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;LOWER()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the argument in lowercase &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;LPAD()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the string argument, left-padded with the specified string&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;LTRIM()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Remove leading spaces&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;MAKE_SET()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return a set of comma-separated strings that have the corresponding bit in  bits set&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;MAKEDATE()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Create a date from the year and day of year&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;MAKETIME&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;MAKETIME()&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;MASTER_POS_WAIT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Block until the slave has read and applied all updates up to the specified  position&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;MATCH&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Perform full-text search&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;MAX()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the maximum value&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;MD5()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Calculate MD5 checksum&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;MICROSECOND()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Return the microseconds from argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;MID()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return a substring starting from the specified position&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;MIN()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the minimum value&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;-&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Minus operator&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;MINUTE()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the minute from the argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;MOD()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the remainder&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;%&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Modulo operator&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;MONTH()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the month from the date passed&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;MONTHNAME()&lt;/code&gt;&lt;/a&gt;(v4.1.21)&lt;/td&gt; &lt;td&gt;Return the name of the month&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;NAME_CONST()&lt;/code&gt;&lt;/a&gt;(v5.0.12)&lt;/td&gt; &lt;td&gt;Causes the column to have the given name&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;NOT BETWEEN  ... AND ...&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Check whether a value is not within a range of values&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;!=&lt;/code&gt;,  &lt;code class="literal"&gt;&lt;&gt;&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Not equal operator&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;NOT  IN()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Check whether a value is not within a set of values&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;NOT  LIKE&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Negation of simple pattern matching&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;NOT  REGEXP&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Negation of REGEXP&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;NOT&lt;/code&gt;, &lt;code class="literal"&gt;!&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Negates value&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;NOW()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the current date and time&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;NULLIF()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return NULL if expr1 = expr2&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;OCT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return an octal representation of a decimal number&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;OCTET_LENGTH()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;A synonym for LENGTH()&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;OLD_PASSWORD()&lt;/code&gt;&lt;/a&gt;(v4.1)&lt;/td&gt; &lt;td&gt;Return the value of the old (pre-4.1) implementation of PASSWORD&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;||&lt;/code&gt;, &lt;code class="literal"&gt;OR&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Logical OR&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;ORD()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return character code for leftmost character of the argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;PASSWORD()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Calculate and return a password string&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;PERIOD_ADD()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Add a period to a year-month&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;PERIOD_DIFF()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the number of months between periods&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;PI()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the value of pi&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;+&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Addition operator&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;POSITION()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;A synonym for LOCATE()&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;POW()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the argument raised to the specified power&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;POWER()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the argument raised to the specified power&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a title="22.4.1. PROCEDURE ANALYSE"&gt;&lt;code class="literal"&gt;PROCEDURE  ANALYSE()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Analyze the results of a query&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;QUARTER()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the quarter from a date argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;QUOTE()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Escape the argument for use in an SQL statement&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;RADIANS()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return argument converted to radians&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;RAND()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return a random floating-point value&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;REGEXP&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Pattern matching using regular expressions&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;RELEASE_LOCK()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Releases the named lock&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;REPEAT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Repeat a string the specified number of times&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;REPLACE()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Replace occurrences of a specified string&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;REVERSE()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Reverse the characters in a string&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;&gt;&gt;&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Right shift&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;RIGHT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the specified rightmost number of characters&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;RLIKE&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Synonym for REGEXP&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;ROUND()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Round the argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;ROW_COUNT()&lt;/code&gt;&lt;/a&gt;(v5.0.1)&lt;/td&gt; &lt;td&gt;The number of rows updated&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;RPAD()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Append string the specified number of times&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;RTRIM()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Remove trailing spaces&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;SCHEMA()&lt;/code&gt;&lt;/a&gt;(v5.0.2)&lt;/td&gt; &lt;td&gt;A synonym for DATABASE()&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;SEC_TO_TIME()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Converts seconds to 'HH:MM:SS' format&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;SECOND()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the second (0-59)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;SESSION_USER()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Synonym for USER()&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;SHA1()&lt;/code&gt;,  &lt;code class="literal"&gt;SHA()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Calculate an SHA-1 160-bit checksum&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;SIGN()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the sign of the argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;SIN()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the sine of the argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;SLEEP()&lt;/code&gt;&lt;/a&gt;(v5.0.12)&lt;/td&gt; &lt;td&gt;Sleep for a number of seconds&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;SOUNDEX()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return a soundex string&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;SOUNDS  LIKE&lt;/code&gt;&lt;/a&gt;(v4.1.0)&lt;/td&gt; &lt;td&gt;Compare sounds&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;SPACE()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return a string of the specified number of spaces&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;SQRT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the square root of the argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;STD()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the population standard deviation&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;STDDEV_POP()&lt;/code&gt;&lt;/a&gt;(v5.0.3)&lt;/td&gt; &lt;td&gt;Return the population standard deviation&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;STDDEV_SAMP()&lt;/code&gt;&lt;/a&gt;(v5.0.3)&lt;/td&gt; &lt;td&gt;Return the sample standard deviation&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;STDDEV()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the population standard deviation&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;STR_TO_DATE()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Convert a string to a date&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;STRCMP()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Compare two strings&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;SUBDATE()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;A synonym for DATE_SUB() when invoked with three arguments&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;SUBSTR()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the substring as specified&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;SUBSTRING_INDEX()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return a substring from a string before the specified number of occurrences  of the delimiter&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;SUBSTRING()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the substring as specified&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;SUBTIME()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Subtract times&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;SUM()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the sum&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;SYSDATE()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the time at which the function executes&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;SYSTEM_USER()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Synonym for USER()&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;TAN()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the tangent of the argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;TIME_FORMAT()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Format as time&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;TIME_TO_SEC()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the argument converted to seconds&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;TIME()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Extract the time portion of the expression passed&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;TIMEDIFF()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Subtract time&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;*&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Times operator&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;TIMESTAMP()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;With a single argument, this function returns the date or datetime  expression; with two arguments, the sum of the arguments&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;TIMESTAMPADD()&lt;/code&gt;&lt;/a&gt;(v5.0.0)&lt;/td&gt; &lt;td&gt;Add an interval to a datetime expression&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;TIMESTAMPDIFF()&lt;/code&gt;&lt;/a&gt;(v5.0.0)&lt;/td&gt; &lt;td&gt;Subtract an interval from a datetime expression&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;TO_DAYS()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the date argument converted to days&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;TRIM()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Remove leading and trailing spaces&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;TRUNCATE()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Truncate to specified number of decimal places&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;UCASE()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Synonym for UPPER()&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;-&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Change the sign of the argument&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;UNCOMPRESS()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Uncompress a string compressed&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;UNCOMPRESSED_LENGTH()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Return the length of a string before compression&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;UNHEX()&lt;/code&gt;&lt;/a&gt;(v4.1.2)&lt;/td&gt; &lt;td&gt;Convert each pair of hexadecimal digits to a character&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;UNIX_TIMESTAMP()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return a UNIX timestamp&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;UpdateXML()&lt;/code&gt;&lt;/a&gt;(v5.1.5)&lt;/td&gt; &lt;td&gt;Return replaced XML fragment&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;UPPER()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Convert to uppercase&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;USER()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the current username and hostname&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;UTC_DATE()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Return the current UTC date&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;UTC_TIME()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Return the current UTC time&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;UTC_TIMESTAMP()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Return the current UTC date and time&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;UUID_SHORT()&lt;/code&gt;&lt;/a&gt;(v5.1.20)&lt;/td&gt; &lt;td&gt;Return an integer-valued universal identifier&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;UUID()&lt;/code&gt;&lt;/a&gt;(v4.1.2)&lt;/td&gt; &lt;td&gt;Return a Universal Unique Identifier (UUID)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;VALUES()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Defines the values to be used during an INSERT&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;VAR_POP()&lt;/code&gt;&lt;/a&gt;(v5.0.3)&lt;/td&gt; &lt;td&gt;Return the population standard variance&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;VAR_SAMP()&lt;/code&gt;&lt;/a&gt;(v5.0.3)&lt;/td&gt; &lt;td&gt;Return the sample variance&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;VARIANCE()&lt;/code&gt;&lt;/a&gt;(v4.1)&lt;/td&gt; &lt;td&gt;Return the population standard variance&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;VERSION()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Returns a string that indicates the MySQL server version&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;WEEK()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the week number&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;WEEKDAY()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the weekday index&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;WEEKOFYEAR()&lt;/code&gt;&lt;/a&gt;(v4.1.1)&lt;/td&gt; &lt;td&gt;Return the calendar week of the date (0-53)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;XOR&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Logical XOR&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;YEAR()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the year&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;a&gt;&lt;code class="literal"&gt;YEARWEEK()&lt;/code&gt;&lt;/a&gt;&lt;/td&gt; &lt;td&gt;Return the year and week&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-4774597364663453759?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/4774597364663453759/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2009/06/operator-and-function-reference-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/4774597364663453759'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/4774597364663453759'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2009/06/operator-and-function-reference-in.html' title='Operator and Function Reference in mysql'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-5908917656839593184</id><published>2009-05-21T14:11:00.000+05:30</published><updated>2009-05-21T14:14:31.922+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='post'/><category scheme='http://www.blogger.com/atom/ns#' term='php ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='request'/><title type='text'>XMLHttp POST Requests in php ajax</title><content type='html'>&lt;div&gt;&lt;span class="Apple-style-span"   style="  white-space: pre-wrap; font-family:-webkit-monospace;font-size:13px;"&gt;Now that you've seen how XMLHttp can simplify GET requests, it's time to take a look at POST requests. First, you need to make the same changes to SaveCustomer.php as you did for GetCustomerInfo.php, which means you need to remove extraneous HTML and JavaScript, add the content type information, and output the text:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  white-space: pre-wrap;font-family:-webkit-monospace;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  white-space: pre-wrap; font-family:-webkit-monospace;font-size:13px;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  white-space: pre-wrap; font-family:-webkit-monospace;font-size:13px;"&gt; This now represents the entirety of SaveCustomer.php. Note that the header() function is called to set the content type, and echo is used to output $sStatus. In the main page, the simple form that was set up to allow entry of new customer info is the following:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  white-space: pre-wrap; font-family:-webkit-monospace;font-size:13px;"&gt; &lt;form method="post" action="SaveCustomer.php" onsubmit="sendRequest(); return false"&gt; &lt;p&gt;Enter customer information to be saved:&lt;/p&gt; &lt;p&gt;Customer Name: &lt;input type="text" name="txtName" value=""&gt;&lt;br /&gt;Address: &lt;input type="text" name="txtAddress" value=""&gt;&lt;br /&gt;City: &lt;input type="text" name="txtCity" value=""&gt;&lt;br /&gt;State: &lt;input type="text" name="txtState" value=""&gt;&lt;br /&gt;Zip Code: &lt;input type=" text" name="txtZipCode" value=""&gt;&lt;br /&gt;Phone: &lt;input type="text" name="txtPhone" value=""&gt;&lt;br /&gt;E-mail: &lt;input type="text" name="txtEmail" value=""&gt;&lt;/p&gt; &lt;p&gt;&lt;input type="button" value="Save Customer Info"&gt;&lt;/p&gt; &lt;/form&gt; &lt;div id="divStatus"&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  white-space: pre-wrap; font-family:-webkit-monospace;font-size:13px;"&gt; You'll note that the onsubmit event handler has now changed to call the function sendRequest() (although the event handler still returns false to prevent actual form submission). This method first assembles the data for the POST request and then creates the XMLHttp object to send it. The data must be sent in the format as a query string:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  white-space: pre-wrap; font-family:-webkit-monospace;font-size:13px;"&gt; name1=value1&amp;amp;name2=value2&amp;amp;name3=value3&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  white-space: pre-wrap; font-family:-webkit-monospace;font-size:13px;"&gt; Both the name and value of each parameter must be URL-encoded in order to avoid data loss during transmission. JavaScript provides a built-in function called encodeURIComponent() that can be used to perform this encoding. To create this string, you'll need to iterate over the form fields, extracting and encoding the name and value. The getRequestBody() function handles this:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  white-space: pre-wrap; font-family:-webkit-monospace;font-size:13px;"&gt; function getRequestBody(oForm) { var aParams = new Array(); for (var i=0 ; i &lt; sparam =" encodeURIComponent(oForm.elements[i].name);"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  white-space: pre-wrap; font-family:-webkit-monospace;font-size:13px;"&gt; This function assumes that you will supply a reference to the form as an argument. An array (aParams) is created to store each individual name-value pair. Then, the elements of the form are iterated over, building up a string and storing it in sParam, which is then added to the array. Doing this prevents multiple string concatenation, which can lead to slower code execution in some browsers. The last step is to call join() on the array, passing in the ampersand character. This effectively combines all the name-value pairs with ampersands, creating a single string in the correct format.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  white-space: pre-wrap; font-family:-webkit-monospace;font-size:13px;"&gt; The sendRequest() function calls getRequestBody() and sets up the request:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  white-space: pre-wrap; font-family:-webkit-monospace;font-size:13px;"&gt; function sendRequest() { var oForm = document.forms[0]; var sBody = getRequestBody(oForm); var oXmlHttp = zXmlHttp.createRequest(); oXmlHttp.open("post", oForm.action, true); oXmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); oXmlHttp.onreadystatechange = function () { if (oXmlHttp.readyState == 4) { if (oXmlHttp.status == 200) { saveResult(oXmlHttp.responseText); } else { saveResult("An error occurred: "+ oXmlHttp.statusText); } } }; oXmlHttp.send(sBody); }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  white-space: pre-wrap; font-family:-webkit-monospace;font-size:13px;"&gt;As with previous examples, the first step in this function is to get a reference to the form and store it in a variable (oForm). Then, the request body is generated and stored in sBody. Next comes the creation and setup of the XMLHttp object. Note that the first argument of open() is now post instead of get, and the second is set to oForm.action (once again, so this script can be used on multiple pages). You'll also notice that a request header is being set. When a form is posted from the browser to a server, it sets the content type of the request as application/x-www-form-urlencoded. Most server-side languages look for this encoding in order to parse the incoming POST data properly, so it is very important for it to be set. The onreadystatechange event handler is very similar to that of the GET example; the only change is the call to saveResult() instead of displayCustomerInfo(). The last line is very important, as the sBody string is passed to send() so that it will become part of the request body. This effectively mimics what the browser does, so all server-side logic should work as expected.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-5908917656839593184?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/5908917656839593184/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2009/05/xmlhttp-post-requests-in-php-ajax.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/5908917656839593184'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/5908917656839593184'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2009/05/xmlhttp-post-requests-in-php-ajax.html' title='XMLHttp POST Requests in php ajax'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-5255082329723560970</id><published>2009-05-21T14:05:00.000+05:30</published><updated>2009-05-21T14:08:01.507+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='php 6.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='JAvascript'/><category scheme='http://www.blogger.com/atom/ns#' term='php  object'/><title type='text'>Creating an XMLHttp Object in PHP AJAX</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt;The first step to using an XMLHttp object is, obviously, to create one. Because Microsoft's implementation is an ActiveX control, you must use the proprietary ActiveXObject class in JavaScript, passing in the XMLHttp control's signature:&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; var oXmlHttp = new ActiveXObject("Microsoft.XMLHttp");&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; This line creates the first version of the XMLHttp object (the one shipped with IE 5.0). The problem is that there have been several new versions released with each subsequent release of the MSXML library. Each release brings with it better stability and speed, so you want to make sure you are always using the most recent version available on the user's machine. The signatures are:&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; 1 Microsoft.XMLHttp 2 MSXML2.XMLHttp 3 MSXML2.XMLHttp.3.0 4 MSXML2.XMLHttp.4.0 5 MSXML2.XMLHttp.5.0&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; Unfortunately, the only way to determine the best version to use is to try to create each one. Because this is an ActiveX control, any failure to create an object will throw an error, which means that you must enclose each attempt within a try...catch block. The end result is a function such as this:&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; function createXMLHttp() { var aVersions = [ "MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp","Microsoft.XMLHttp" ]; for (var i = 0; i &lt; oxmlhttp =" new"&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; The createXMLHttp() function stores an array of XMLHttp signatures, with the most recent one first. It iterates through this array and tries to create an XMLHttp object with each signature. If the creation fails, the catch statement prevents a JavaScript error from stopping execution; then the next signature is attempted. When an object is created, it is returned. If the function completes without creating an XMLHttp object, an error is thrown indicating that the creation failed. Fortunately, creating an XMLHttp object is much easier in other browsers. Mozilla Firefox, Safari, and Opera all use the same code:&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; var oXmlHttp = new XMLHttpRequest();&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; Naturally, it helps to have a cross-browser way of creating XMLHttp objects. You can create such a function by altering the createXMLHttp() function defined previously: function createXMLHttp() { if (typeof XMLHttpRequest != "undefined") { return new XMLHttpRequest(); } else if (window.ActiveXObject) { var aVersions = [ "MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp","Microsoft.XMLHttp" ]; for (var i = 0; i &lt; oxmlhttp =" new"&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; The other option for creating cross-browser XMLHttp objects is to use a library that already has cross-browser code written. The zXml library, written by two of your authors, is one such library and is available for download at www.nczonline.net/downloads/. This library defines a single function for the creation of XMLHttp objects: var oXmlHttp = zXmlHttp.createRequest(); The createRequest() function, and the zXml library itself, will be used throughout this book to aid in cross-browser handling of Ajax technologies. Using XMLHttp After you have created an XMLHttp object, you are ready to start making HTTP requests from JavaScript. The first step is to call the open() method, which initializes the object. This method accepts the following three arguments:&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt;  Request Type: A string indicating the request type to be made — typically, GET or POST (these are the only ones currently supported by all browsers).  URL: A string indicating the URL to send the request to.  Async: A Boolean value indicating whether the request should be made asynchronously.&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; The last argument, async, is very important because it controls how JavaScript executes the request. When set to true, the request is sent asynchronously, and JavaScript code execution continues without waiting for the response; you must use an event handler to watch for the response to the request. If async is set to false, the request is sent synchronously, and JavaScript waits for a response from the server before continuing code execution. That means if the response takes a long time, the user cannot interact with the browser until the response has completed. For this reason, best practices around the development of Ajax applications favor the use of asynchronous requests for routine data retrieval, with synchronous requests reserved for short messages sent to and from the server. To make an asynchronous GET request to info.txt, you would start by doing this:&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; var oXmlHttp = zXmlHttp.createRequest(); oXmlHttp.open("get", "info.txt", true);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; Note that the case of the first argument, the request type, is irrelevant even though technically request types are defined as all uppercase. Next, you need to define an onreadystatechange event handler. The XMLHttp object has a property called readyState that changes as the request goes through and the response is received. There are five possible values for readyState:&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt;  0 (Uninitialized): The object has been created but the open() method hasn't been called.  1 (Loading): The open() method has been called but the request hasn't been sent.  2 (Loaded): The request has been sent.  3 (Interactive). A partial response has been received.  4 (Complete): All data has been received and the connection has been closed.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; Every time the readyState property changes from one value to another, the readystatechange event fires and the onreadystatechange event handler is called. Because of differences in browser implementations, the only reliable readyState values for cross-browser development are 0, 1, and 4. In most cases, however, you will check only for 4 to see when the request has returned: var oXmlHttp = zXmlHttp.createRequest(); oXmlHttp.open("get", "info.txt", true); oXmlHttp.onreadystatechange = function () { if (oXmlHttp.readyState == 4) { alert("Got response."); } }; The last step is to call the send() method, which actually sends the request. This method accepts a single argument, which is a string for the request body. If the request doesn't require a body (remember, a GET request doesn't), you must pass in null:&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; var oXmlHttp = zXmlHttp.createRequest(); oXmlHttp.open("get", "info.txt", true); oXmlHttp.onreadystatechange = function () { if (oXmlHttp.readyState == 4) { alert("Got response."); } }; oXmlHttp.send(null); That's it! The request has been sent and when the response is received, an alert will be displayed. But just showing a message that the request has been received isn't very useful. The true power of XMLHttp is that you have access to the returned data, the response status, and the response headers.&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; To retrieve the data returned from the request, you can use the responseText or responseXML properties. The responseText property returns a string containing the response body, whereas the responseXML property is an XML document object used only if the data returned has a content type of text/xml. (XML documents are discussed in Chapter 4.) So, to get the text contained in info.txt, the call would be as follows:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; var sData = oXmlHttp.responseText;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; Note that this will return the text in info.txt only if the file was found and no errors occurred. If, for example, info.txt didn't exist, then the responseText would contain the server's 404 message. Fortunately, there is a way to determine if any errors occurred. The status property contains the HTTP status code sent in the response, and statusText contains the text description of the status (such as "OK" or "Not Found"). Using these two properties, you can make sure the data you've received is actually the data you want or tell the user why the data wasn't retrieved: if (oXmlHttp.status == 200) { alert("Data returned is: "+ oXmlHttp.responseText; } else { alert("An error occurred: "+ oXmlHttp.statusText; } Generally, you should always ensure that the status of a response is 200, indicating that the request was completely successful. The readyState property is set to 4 even if a server error occurred, so just checking that is not enough. In this example, the responseText property is shown only if the status is 200; otherwise, the error message is displayed. Important The statusText property isn't implemented in Opera and sometimes returns an inaccurate description in other browsers. You should never rely on statusText alone to determine if an error occurred. As mentioned previously, it's also possible to access the response headers. You can retrieve a specific header value using the getResponseHeader() method and passing in the name of the header that you want to retrieve. One of the most useful response headers is Content-Type, which tells you the type of data being sent:&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; var sContentType = oXmlHttp.getResponseHeader("Content-Type"); if (sContentType == "text/xml") { alert("XML content received."); } else if (sContentType == "text/plain") { alert("Plain text content received."); } else { alert("Unexpected content received."); } This code snippet checks the content type of the response and displays an alert indicating the type of data returned. Typically, you will receive only XML data (content type of text/xml) or plain text (content type of text/plain) from the server, because these content types are the easiest to work with using JavaScript. If you'd prefer to see all headers returned from the server, you can use the getAllResponseHeaders() method, which simply returns a string containing all of the headers. Each heading in the string is separated by either a new line character (\n in JavaScript) or a combination of the carriage return and new line (\r\n in JavaScript), so you can deal with individual headers as follows:&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; var sHeaders = oXmlHttp.getAllResponseHeaders(); var aHeaders = sHeaders.split(/\r?\n/); for (var i=0; i &lt;&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; It's also possible to set headers on the request before it's sent out. You may want to indicate the content type of data that you'll be sending, or you may just want to send along some extra data that the server may need to deal with the request. To do so, use the setRequestHeader() method before calling send():&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; var oXmlHttp = zXmlHttp.createRequest(); oXmlHttp.open("get", "info.txt", true); oXmlHttp.onreadystatechange = function () { if (oXmlHttp.readyState == 4) { alert("Got response."); } }; oXmlHttp.setRequestHeader("myheader", "myvalue"); oXmlHttp.send(null); In this code, a header named myheader is added to the request before it's sent out. The header will be added to the default headers as myheader: myvalue. Up to this point, you've been dealing with asynchronous requests, which are preferable in most situations. Sending synchronous requests means that you don't need to assign theonreadystatechange event handler because the response will have been received by the time the send() method returns. This makes it possible to do something like this: var oXmlHttp = zXmlHttp.createRequest(); oXmlHttp.open("get", "info.txt", false); oXmlHttp.send(null); if (oXmlHttp.status == 200) { alert("Data returned is: "+ oXmlHttp.responseText; } else { alert("An error occurred: "+ oXmlHttp.statusText; }&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; Sending the request synchronously (setting the third argument of open() to false) enables you to start evaluating the response immediately after the call to send(). This can be useful if you want the user interaction to wait for a response or if you're expecting to receive only a very small amount of data (for example, less than 1K). In the case of average or larger amounts of data, it's best to use an asynchronous call.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-5255082329723560970?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/5255082329723560970/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2009/05/creating-xmlhttp-object-in-php-ajax.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/5255082329723560970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/5255082329723560970'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2009/05/creating-xmlhttp-object-in-php-ajax.html' title='Creating an XMLHttp Object in PHP AJAX'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-2860298550865248666</id><published>2009-05-21T14:04:00.001+05:30</published><updated>2009-05-21T14:04:47.226+05:30</updated><title type='text'>XMLHttp Requests in PHP</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt;When Microsoft Internet Explorer 5.0 introduced a rudimentary level of XML support, an ActiveX library called MSXML was also introduced (discussed at length in Chapter 4). One of the objects provided in this library quickly became very popular: XMLHttp. The XMLHttp object was created to enable developers to initiate HTTP requests from anywhere in an application. These requests were intended to return XML, so the XMLHttp object provided an easy way to access this information in the form of an XML document. Since it was an ActiveX control, XMLHttp could be used not only in web pages but also in any Windows-based desktop application; however, its popularity on the Web has far outpaced its popularity for desktop applications.&lt;br /&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt;Picking up on that popularity, Mozilla duplicated the XMLHttp functionality for use in its browsers, such as Firefox. Shortly thereafter, both the Safari (as of version 1.2) and Opera (version 7.6) browsers had duplicated Mozilla's implementation. Today, all four browsers support XMLHttp to some extent. (Safari and Opera still have incomplete implementations, supporting GET and POST but no other request types.)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-2860298550865248666?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/2860298550865248666/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2009/05/xmlhttp-requests-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/2860298550865248666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/2860298550865248666'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2009/05/xmlhttp-requests-in-php.html' title='XMLHttp Requests in PHP'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-7427899178168476872</id><published>2009-05-21T14:03:00.000+05:30</published><updated>2009-05-21T14:09:28.183+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='php ajax'/><title type='text'>Advantages and Disadvantages of XMLHttp in php ajax</title><content type='html'>&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; you can see the advantage of using XMLHttp for client-server communication instead of hidden frames. The code you write is much cleaner and the intent of the code is much more apparent than using numerous callback functions with hidden frames. You have access to request and response headers as well as HTTP status codes, enabling you to determine if your request was successful.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt;The downside is that, unlike hidden frames, there is no browser history record of the calls that were made. The Back and Forward buttons do not tie in to XMLHttp requests, so you have effectively cut off their use. It is for this reason that many Ajax applications use a mixture of XMLHttp and hidden frames to make a truly usable interface.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; Another disadvantage, which applies to Internet Explorer only, is that you depend on ActiveX controls being enabled. If the user has your page set up in a particular security zone that doesn't allow ActiveX controls, you cannot access the XMLHttp object. In that case, you may have to default to using hidden frames.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-7427899178168476872?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/7427899178168476872/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2009/05/advantages-and-disadvantages-of-xmlhttp.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/7427899178168476872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/7427899178168476872'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2009/05/advantages-and-disadvantages-of-xmlhttp.html' title='Advantages and Disadvantages of XMLHttp in php ajax'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-8484151202559506476</id><published>2009-05-21T14:00:00.000+05:30</published><updated>2009-05-21T14:10:53.409+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='xmlhttp'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><title type='text'>XMLHttp GET Requests in php ajax</title><content type='html'>&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt;It's time to revisit the hidden frame GET example to see how the process could be improved using XMLHttp. The first change will be to GetCustomerData.php, which must be changed from an HTML page to simply return an HTML snippet. &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt;&lt;?php header("Content-Type: text/plain"); $sID = $_GET["id"]; $sInfo = ""; $sDBServer = "your.databaser.server"; $sDBName = "your_db_name"; $sDBUsername = "your_db_username"; $sDBPassword = "your_db_password"; $sQuery = "Select * from Customers where CustomerId=".$sID; $oLink = mysql_connect($sDBServer,$sDBUsername,$sDBPassword); @mysql_select_db($sDBName) or $sInfo=" Unable to open database"; if($oResult = mysql_query($sQuery) and mysql_num_rows($oResult) &gt; 0) { $aValues = mysql_fetch_array($oResult,MYSQL_ASSOC); $sInfo = $aValues['Name']."&lt;br /&gt;".$aValues['Address']."&lt;br /&gt;". $aValues['City']."&lt;br /&gt;".$aValues['State']."&lt;br /&gt;". $aValues['Zip']."&lt;br /&gt;&lt;br /&gt;Phone: ".$aValues['Phone']."&lt;br /&gt;". "&lt;a href="\"&gt;". $aValues['E-mail']."&lt;/a&gt;"; } else { $sInfo = "Customer with ID $sID doesn't exist."; } mysql_close($oLink); echo $sInfo; ?&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; As you can see, there are no visible HTML or JavaScript calls in the page. All the main logic remains the same, but there are two additional lines of PHP code. The first occurs at the beginning, where the header() function is used to set the content type of the page. Even though the page will return an HTML snippet, it's fine to set the content type as text/plain, because it's not a complete HTML page (and therefore wouldn't validate as HTML). You should always set the content type in any page that is sending non-HTML to the browser. The second added line is towards the bottom, where the $sInfo variable is output to the stream by using the echo command. In the main HTML page, the basic setup is this:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; &lt;p&gt;Enter customer ID number to retrieve information:&lt;/p&gt; &lt;p&gt;Customer ID: &lt;input type="text" id="txtCustomerId" value=""&gt;&lt;/p&gt; &lt;p&gt;&lt;input type="button" value="Get Customer Info" onclick="requestCustomerInfo()"&gt;&lt;/p&gt; &lt;div id="divCustomerInfo"&gt;&lt;/div&gt; The requestCustomerInfo() function previously created a hidden iframe but now must be changed to use XMLHttp: function requestCustomerInfo() { var sId = document.getElementById("txtCustomerId").value; var oXmlHttp = zXmlHttp.createRequest(); oXmlHttp.open("get", "GetCustomerData.php?id=" + sId, true); oXmlHttp.onreadystatechange = function () { if (oXmlHttp.readyState == 4) { if (oXmlHttp.status == 200) { displayCustomerInfo(oXmlHttp.responseText); } else { displayCustomerInfo("An error occurred: "+ oXmlHttp.statusText); } } }; oXmlHttp.send(null); }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; Note that the function begins the same way, by retrieving the ID the user entered. Then, an XMLHttp object is created using the zXml library. The open() method is called, specifying an asynchronous GET request for GetCustomerData.php (which has the aforementioned ID added to its query string). Next comes the assignment of the event handler, which checks for a readyState of 4 and then checks the status of the request. If the request was successful (status of 200), the displayCustomerInfo() function is called with the response body (accessed via responseText). If there was an error (status is not 200), then the error information is passed to displayCustomerInfo().&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: -webkit-monospace; font-size: 13px; white-space: pre-wrap; "&gt; There are several differences between this and the hidden frame/iframe example. First, no JavaScript code is required outside of the main page. This is important because any time you need to keep code in two different places there is the possibility of creating incompatibilities; in the frame-based examples, you relied on separate scripts in the display page and the hidden frames to communicate with one another. By changing GetCustomerInfo.php to return just the data you're interested in, you have eliminated potential problems with JavaScript calling between these locations. The second difference is that it's much easier to tell if there was a problem executing the request. In previous examples, there was no mechanism by which you could identify and respond to a server error in the request process. Using XMLHttp, all server errors are revealed to you as a developer, enabling you to pass along meaningful error feedback to the user. In many ways, XMLHttp is a more elegant solution than hidden frames for in-page HTTP requests.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-8484151202559506476?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/8484151202559506476/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2009/05/xmlhttp-get-requests-in-php-ajax.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/8484151202559506476'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/8484151202559506476'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2009/05/xmlhttp-get-requests-in-php-ajax.html' title='XMLHttp GET Requests in php ajax'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-1236103352589385635</id><published>2009-05-21T13:56:00.000+05:30</published><updated>2009-05-21T13:59:54.900+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='php 6.0'/><title type='text'>Overview of Changes in PHP 6</title><content type='html'>&lt;div&gt;PHP 6.0 is, in many ways, a “cleanup” release for the language. In addition to&lt;/div&gt;&lt;div&gt;cleaning up the object model and fixing many bugs, PHP 6.0 adds full Unicode&lt;/div&gt;&lt;div&gt;support from the ground up. It introduces large integers (64-bit) and better SQL&lt;/div&gt;&lt;div&gt;Lite functionality, and includes all of the changes from PHP 5.1 through the final&lt;/div&gt;&lt;div&gt;releases of the 5.0 line, as well as everything new in 6.0.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-1236103352589385635?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/1236103352589385635/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2009/05/overview-of-changes-in-php-6.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/1236103352589385635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/1236103352589385635'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2009/05/overview-of-changes-in-php-6.html' title='Overview of Changes in PHP 6'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-6271756736378876075</id><published>2009-05-08T15:57:00.000+05:30</published><updated>2009-05-08T15:59:53.791+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='variable scope'/><category scheme='http://www.blogger.com/atom/ns#' term='php  object'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='PHP variable scope'/><title type='text'>Understanding Variable Scope in PHP</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Understanding Variable Scope&lt;/span&gt;&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;inside a function to variables that hold arguments don't affect those variables outside of the function. This is because activity inside a function happens in a different scope. Variables defined outside of a function are called global variables. They exist in one scope. Variables defined inside of a function are called local variables. Each function has its own scope.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;Imagine each function is one branch office of a big company, and the code outside of any function is the company headquarters. At the Philadelphia branch office, co-workers refer to each other by their first names: "Alice did great work on this report," or "Bob never puts the right amount of sugar in my coffee." These statements talk about the folks in Philadelphia (local variables of one function), and say nothing about an Alice or a Bob who works at another branch office (local variables of another function) or at company headquarters (global variables).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;b&gt;Local and global variables&lt;/b&gt; work similarly. A variable called $dinner inside a function, whether or not it's an argument to that function, is completely disconnected from a variable called $dinner outside of the function and from a variable called $dinner inside another function. Example 5-20 illustrates the unconnectedness of variables in different scopes.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Variable scope&lt;/b&gt;&lt;br /&gt;$dinner = 'Curry Cuttlefish';&lt;br /&gt;function vegetarian_dinner( ) {&lt;br /&gt;&lt;br /&gt;   print "Dinner is $dinner, or ";&lt;br /&gt;   $dinner = 'Sauteed Pea Shoots';&lt;br /&gt;   print $dinner;&lt;br /&gt;   print "\n";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function kosher_dinner( ) {&lt;br /&gt;   print "Dinner is $dinner, or ";&lt;br /&gt;   $dinner = 'Kung Pao Chicken';&lt;br /&gt;   print $dinner;&lt;br /&gt;   print "\n";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;print "Vegetarian ";&lt;br /&gt;vegetarian_dinner( );&lt;br /&gt;print "Kosher ";&lt;br /&gt;kosher_dinner( );&lt;br /&gt;print "Regular dinner is $dinner";&lt;br /&gt;&lt;br /&gt;&lt;b&gt;prints:&lt;/b&gt;&lt;br /&gt;Vegetarian Dinner is , or Sauteed Pea Shoots&lt;br /&gt;Kosher Dinner is , or Kung Pao Chicken&lt;br /&gt;Regular dinner is Curry Cuttlefish&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In both functions, before $dinner is set to a value inside the function, it has no value. The global variable $dinner has no effect inside the function. Once $dinner is set inside a function, though, it doesn't affect the global $dinner set outside any function or the $dinner variable in another function. Inside each function, $dinner refers to the local version of $dinner and is completely separate from a variable that happens to have the same name in another function.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;Like all analogies, though, the analogy between variable scope and corporate organization is not perfect. In a company, you can easily refer to employees at other locations; the folks in Philadelphia can talk about "Alice at headquarters" or "Bob in Atlanta," and the overlords at headquarters can decide the futures of "Alice in Philadelphia" or "Bob in Charleston." With variables, however, you can access global variables from inside a function, but you can't access the local variables of a function from outside that function. This is equivalent to folks at a branch office being able to talk about people at headquarters but not anyone at the other branch offices, and to folks at headquarters not being able to talk about anyone at any branch office.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;There are two ways to access a global variable from inside a function. The most straightforward is to look for them in a special array called $GLOBALS. Each global variable is accessible as an element in that array.  demonstrates how to use the $GLOBALS array.&lt;br /&gt;&lt;br /&gt;The $GLOBALS array&lt;br /&gt;$dinner = 'Curry Cuttlefish';&lt;br /&gt;&lt;br /&gt;function macrobiotic_dinner( ) {&lt;br /&gt;   $dinner = "Some Vegetables";&lt;br /&gt;   print "Dinner is $dinner";&lt;br /&gt;   // Succumb to the delights of the ocean&lt;br /&gt;   print " but I'd rather have ";&lt;br /&gt;   print $GLOBALS['dinner'];&lt;br /&gt;   print "\n";&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;macrobiotic_dinner( );&lt;br /&gt;print "Regular dinner is: $dinner";&lt;br /&gt;&lt;br /&gt;&lt;b&gt;prints:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Dinner is Some Vegetables but I'd rather have Curry Cuttlefish&lt;br /&gt;Regular dinner is: Curry Cuttlefish&lt;br /&gt;&lt;br /&gt;accesses the global $dinner from inside the function as $GLOBALS['dinner']. The $GLOBALS array can also modify global variables.&lt;br /&gt;&lt;br /&gt;Modifying a variable with $GLOBALS&lt;br /&gt;$dinner = 'Curry Cuttlefish';&lt;br /&gt;&lt;br /&gt;function hungry_dinner( ) {&lt;br /&gt;   $GLOBALS['dinner'] .= ' and Deep-Fried Taro';&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;print "Regular dinner is $dinner";&lt;br /&gt;print "\n";&lt;br /&gt;hungry_dinner( );&lt;br /&gt;print "Hungry dinner is $dinner";&lt;br /&gt;&lt;br /&gt;&lt;b&gt;prints:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Regular dinner is Curry Cuttlefish&lt;br /&gt;Hungry dinner is Curry Cuttlefish and Deep-Fried Taro&lt;br /&gt;Inside the hungry_dinner( ) function, $GLOBALS['dinner'] can be modified just like any other variable, and the modifications change the global variable $dinner. In this case, $GLOBALS['dinner'] has a string appended to it using the concatenation operator.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;The second way to access a global variable inside a function is to use the global keyword. This tells the PHP interpreter that further use of the named variable inside a function should refer to the global variable with the given name, not a local variable. This is called "bringing a variable into local scope."&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The global keyword&lt;/b&gt;&lt;br /&gt;$dinner = 'Curry Cuttlefish';&lt;br /&gt;&lt;br /&gt;function vegetarian_dinner( ) {&lt;br /&gt;   global $dinner;&lt;br /&gt;   print "Dinner was $dinner, but now it's ";&lt;br /&gt;   $dinner = 'Sauteed Pea Shoots';&lt;br /&gt;   print $dinner;&lt;br /&gt;   print "\n";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;print "Regular Dinner is $dinner.\n";&lt;br /&gt;vegetarian_dinner( );&lt;br /&gt;print "Regular dinner is $dinner";&lt;br /&gt;&lt;br /&gt;prints:&lt;br /&gt;&lt;br /&gt;Regular Dinner is Curry Cuttlefish.&lt;br /&gt;Dinner was Curry Cuttlefish, but now it's Sauteed Pea Shoots&lt;br /&gt;Regular dinner is Sauteed Pea Shoots&lt;br /&gt;&lt;br /&gt;The first print statement displays the unmodified value of the global variable $dinner. The global $dinner line in vegetarian_dinner( ) means that any use of $dinner inside the function refers to the global $dinner, not a local variable with the same name. So, the first print statement in the function prints the already-set global value, and the assignment on the next line changes the global value. Since the global value is changed inside the function, the last print statement outside the function prints the changed value as well.&lt;br /&gt;The global keyword can be used with multiple variable names at once. Just separate each variable name with a comma. &lt;/div&gt;&lt;div&gt;For example:&lt;br /&gt;global $dinner, $lunch, $breakfast;&lt;br /&gt;&lt;br /&gt;Generally, I recommend that you use the $GLOBALS array to access global variables inside functions instead of the global keyword. Using $GLOBALS provides a reminder on every variable access that you're dealing with a global variable. Unless you're writing a very short function, it's easy to forget that you're dealing with a global variable with global and become confused as to why your code is misbehaving. Relying on the $GLOBALS array requires a tiny bit of extra typing, but it does wonders for your code's intelligibility.&lt;br /&gt;&lt;br /&gt;You may have noticed something strange about the examples that use the $GLOBALS array. These examples use $GLOBALS inside a function, but don't bring $GLOBALS into local scope with the global keyword. The $GLOBALS array, whether used inside or outside a function, is always in scope. This is because $GLOBALS is a special kind of pre-defined variable, called an auto-global . Auto-globals are variables that can be used anywhere in your PHP programs without anything required to bring them into scope. They're like a well-known employee that everyone, at headquarters or a branch office, refers to by his first name.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;The auto-globals are always arrays that are automatically populated with data. They contain things such as submitted form data, cookie values, and session information.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-6271756736378876075?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/6271756736378876075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2009/05/understanding-variable-scope-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/6271756736378876075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/6271756736378876075'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2009/05/understanding-variable-scope-in-php.html' title='Understanding Variable Scope in PHP'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-2711781543383952773</id><published>2009-05-08T15:39:00.000+05:30</published><updated>2009-05-08T15:41:38.288+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='error repoert'/><category scheme='http://www.blogger.com/atom/ns#' term='php error report'/><title type='text'>Error Reporting in PHP</title><content type='html'>&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Error Reporting&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-size:180%;"&gt;&lt;span class="Apple-style-span" style="font-size: 18px;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Types of Errors in PHP&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Before we can get into remedying ugly error messages on your site, you need to understand the different types of errors. PHP4 can produce 11 different errors, as defined in Table 8-1 below (note that fatal errors stop the script from executing):&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;PHP Error Types &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;NAME        VALUE  DESCRIPTION&lt;/b&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;E_ERROR &lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; 1  Fatal error that occurs at script runtime.&lt;/div&gt;&lt;div&gt;  &lt;/div&gt;&lt;div&gt;E_WARNING&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; 2&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt; Nonfatal error that occurs at runtime (for example, if the script is unable to connect to MySQL).&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;E_PARSE  4  Error that occurs at compile time due to invalid syntax.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;E_NOTICE  8  Nonfatal "notice." Not exactly an error, but a hint that you may be doing something you don't want to, such as dividing a number by zero.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;E_CORE_ERROR  16  Fatal error that occurs when the PHP engine starts. You cannot run any PHP scripts if this error occurs.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;E_CORE_WARNING  32  Nonfatal error that occurs when the PHP engine starts. You can still run PHP scripts, but you may have one or more problems depending on the error (for example, the GD library cannot be found).&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;E_COMPILE_ERROR  64  Fatal error that occurs when the script is compiled.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;E_COMPILE_WARNING  128  Nonfatal error that occurs when the script is compiled.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;E_USER_ERROR  256  User-generated fatal error. Same as E_ERROR, but never thrown by PHP. You can throw this error with the trigger_error() function. If you are using PHP's default error handler, then using this error causes script execution to stop.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;E_USER_WARNING  512  User-generated nonfatal error. Same as E_WARNING, but never thrown by PHP. You can throw this error with the trigger_error() function.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;E_USER_NOTICE  1024  User-generated notice. Same as E_NOTICE, but never thrown by PHP. You can throw this error with the trigger_error() function.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;E_ALL  2047  Not really a type of error. Instead, it is all the errors rolled into one. This makes it easy to say that you want to report all of the errors when using the error_reporting() function.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Of all of these errors, the ones you should mainly concern yourself when it comes to reporting and logging are the following:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;E_WARNING&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;E_NOTICE&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;E_USER_ERROR&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;E_USER_WARNING&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;E_USER_NOTICE&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Other errors that occur usually result in the script not executing. Your reporting and logging function won't even be run, since there is no script execution.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Error Reporting Settings in php.ini&lt;/div&gt;&lt;div&gt;Side Note&lt;/div&gt;&lt;div&gt;This information applies to PHP Version 4 and later. These settings do not work with PHP Version 3.&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The reason you see those "ugly" errors when you are coding is that PHP by default is set to show all errors (E_ALL), with the exception of PHP-generated notices (E_NOTICE). Open your php.ini file and scroll down to the section entitled "Error handling and logging." At the end of all those comments, you should see a line like the following:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;error_reporting = E_ALL &amp;amp; ~E_NOTICE &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This is the default error reporting setting. It's written using bitwise operators and is translated simply to "For Error Reporting Use Everything And Not E_NOTICE." You could also write it as follows (note that we leave out E_NOTICE):&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;[View full width]&lt;/div&gt;&lt;div&gt;error_reporting = E_ERROR | E_WARNING | E_PARSE | E_CORE_ERROR | E_CORE_WARNING | &lt;/div&gt;&lt;div&gt;E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;However, since you are a PHP developer, you really should set this line to read as follows when you are developing an application:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;error_reporting = E_ALL &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You want to see all the errors that your script is producing. You'd be surprised at how many uninitialized variables you might be using.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;error_reporting()&lt;/div&gt;&lt;div&gt;The error_reporting() function allows you to override the default error reporting setting used in php.ini:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;error_reporting(settings); &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The error_reporting function takes one argument, which can either be a string that lists the names of the error reporting settings that you want to use (separated by bitwise operators), or an integer that is the sum of the values that you want to use. For example:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;error_reporting(10); &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;is equivalent to:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;error_reporting("E_WARNING | E_NOTICE"); &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The first version is easier to type, but the second version is more verbose. Additionally, you can subtract values from the E_ALL value (2047) to use "all but" reporting. The example below allows you to display all errors (E_ALL) except for E_NOTICE (2047 - 8):&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;error_reporting(2039); &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you do not want to report any errors, then you could simply use:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;error_reporting(0); &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This stops PHP from displaying any error messages on the screen that are caused by E_WARNING, E_NOTICE or any of the user-thrown warnings. Remember, any of the other warnings are thrown automatically by PHP because there is something either really wrong with the script (parse errors) or really wrong with the server itself.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You still may run into a problem if there is an error that causes the script to fail to compile (such as with parse errors). In that case, no portions of your script are even executed, and the error_reporting() variable is not run. When this happens, PHP uses its php.ini setting for error reporting.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;php.ini Setting: display_errors&lt;/div&gt;&lt;div&gt;Additionally, there is another setting that stops error messages from being displayed on the user's browser. This setting, display_errors, can be found in php.ini. In the event that you want to be sure that errors are never displayed on the screen, you can change this setting to "0" in your php.ini file. You should leave this setting to "1" or "On" while you are developing your application.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can also change the display_errors setting on a per file basis using the ini_set() function. The ini_set() function allows you to change php.ini file settings for the current script. For example, if you had turned off display_errors in your php.ini file, then you could turn it on to debug your script by using the following code, which is the php.ini equivalent of display_errors = On:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;ini_set("display_errors",1); &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Remember, if your script encounters an error that does not allow it to execute, then PHP uses the settings it finds in php.ini, regardless of what you have specified in your script.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-2711781543383952773?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/2711781543383952773/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2009/05/error-reporting-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/2711781543383952773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/2711781543383952773'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2009/05/error-reporting-in-php.html' title='Error Reporting in PHP'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-7563081831491812306</id><published>2009-01-23T10:45:00.001+05:30</published><updated>2009-01-23T11:36:25.745+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Declare Control Structure in php'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='JAvascript'/><category scheme='http://www.blogger.com/atom/ns#' term='search'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='google api'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>Local Search Control Programming Guide in Google API  - Local Search Control for Google Maps</title><content type='html'>Instructions for adding this to your site&lt;br /&gt;Assuming you already have a working maps application, adding the control is a simple two step process (alternatively,you can always start with "hello world" starter andthen customize the esulting code.)&lt;br /&gt;Step 1 - Load AJAX Search API and Local Search Control for Google Maps&lt;br /&gt;&lt;br /&gt;// Load the Code&lt;br /&gt;&amp;lt;script src="http://www.google.com/uds/api?file=uds.js&amp;amp;v=1.0&amp;amp;key=ABQIAAAAipgi6ppj9z1Np5lR2SFXbBSMWlLVwX1ylsLSaLe34pMM37gB9hQjNUQFvLuLRgiSMzRlZIgxSIE1vw"&lt;br /&gt;type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script src="http://www.google.com/uds/solutions/localsearch/gmlocalsearch.js"&lt;br /&gt;type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;// Load the Style Sheets&lt;br /&gt;&amp;lt;style type="text/css"&amp;gt;&lt;br /&gt;@import url("http://www.google.com/uds/css/gsearch.css");&lt;br /&gt;@import url("http://www.google.com/uds/solutions/localsearch/gmlocalsearch.css");&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&lt;br /&gt;The first step is to load the Google AJAX Search API and the Local Search Control code and style sheet into your application. The AJAX Search API uses the same key system that Google Maps API uses, so just use your maps key where required.&lt;br /&gt;&lt;br /&gt;// Load the Code&lt;br /&gt;&amp;lt;script src="http://www.google.com/uds/api?file=uds.js&amp;amp;v=1.0&amp;amp;key=ABQIAAAAipgi6ppj9z1Np5lR2SFXbBSMWlLVwX1ylsLSaLe34pMM37gB9hQjNUQFvLuLRgiSMzRlZIgxSIE1vw"&lt;br /&gt;type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script src="http://www.google.com/uds/solutions/localsearch/gmlocalsearch.js"&lt;br /&gt;type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;// Load the Style Sheets&lt;br /&gt;&amp;lt;style type="text/css"&amp;gt;&lt;br /&gt;@import url("http://www.google.com/uds/css/gsearch.css");&lt;br /&gt;@import url("http://www.google.com/uds/solutions/localsearch/gmlocalsearch.css");&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&lt;br /&gt;Step 2 - Create a Local Search Control&lt;br /&gt;The next step is to create a Local Search control and add it to your map.&lt;br /&gt;&lt;br /&gt;// create your map&lt;br /&gt;var map = new GMap2(document.getElementById("map"));&lt;br /&gt;// create a local search control and add it to your map&lt;br /&gt;map.addControl(new google.maps.LocalSearch());&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Customizing the Local Search Control and Other Advanced Features&lt;/span&gt;&lt;br /&gt;The Local Search Control for Google Maps contains a number of options that you control.&lt;br /&gt;&lt;br /&gt;   * Result List Format and Placement Control&lt;br /&gt;   * Setting the Link Target&lt;br /&gt;   * Custom Search Form Hint Text&lt;br /&gt;   * Idle and Search Completion Callbacks&lt;br /&gt;   * Marker Html Generation and Markers Set CallbacksNew!&lt;br /&gt;   * Setting Focus on the Search Control&lt;br /&gt;   * First Result Info Window Suppression&lt;br /&gt;   * Suppress Default Zoom on Search Complete&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Result List Format and Placement Control&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;By default, when a search completes, the search results are placed on your map and they are also listed in tabular form above the search form input. By using the opt_options argument to the control, you can specify this default behavior, you can suppress the tabular display of&lt;br /&gt;the search results, or you can provide us with a container element and we will place the tabular results within your container. The following snippets and samples demonstrate these options.&lt;br /&gt;Suppressed Tabular Result List&lt;br /&gt;The following snippet and sample demonstrates how to suppress the tabular result list.&lt;br /&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;// request that tabular search results should be suppressed&lt;br /&gt;var options = {&lt;br /&gt;resultList : google.maps.LocalSearch.RESULT_LIST_SUPPRESS&lt;br /&gt;};&lt;br /&gt;map.addControl(new google.maps.LocalSearch(options));&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Default Tabular Result List&lt;/span&gt;&lt;br /&gt;The following snippet and sample demonstrates how to request the default tabular result list.&lt;br /&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;// no option needed, this is the default&lt;br /&gt;map.addControl(new google.maps.LocalSearch());&lt;br /&gt;&lt;br /&gt;// BUT, If you want to, you can explicityly request the default&lt;br /&gt;var options = {&lt;br /&gt;resultList : google.maps.LocalSearch.RESULT_LIST_INLINE&lt;br /&gt;};&lt;br /&gt;map.addControl(new google.maps.LocalSearch(options));&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;External Tabular Result List&lt;/span&gt;&lt;br /&gt;The following snippet and sample demonstrates how to request that the tabular result list be displayed in a container of your choice.&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;&lt;br /&gt;// request that tabular search results be displayed in an external container&lt;br /&gt;var options = {&lt;br /&gt;resultList : document.getElementById("results")&lt;br /&gt;};&lt;br /&gt;map.addControl(new google.maps.LocalSearch(options));&lt;br /&gt;...&lt;br /&gt;&amp;lt;div id="results"&amp;gt;Loading...&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Setting the Link Target&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This option allows you to set the link target used for links embedded in the Local Search Control. The default value is GSearch.LINK_TARGET_BLANK which specifies that will open in a new window. To change this behavior, simply use the linkTarget property of options and supply a value of GSearch.LINK_TARGET_SELF to open links in the current new window, Search.LINK_TARGET_BLANK to open links in a new window, GSearch.LINK_TARGET_TOP to open links in the topmost frame,&lt;br /&gt;GSearch.LINK_TARGET_PARENT to open links in the parent frame or to replace the current frame.&lt;br /&gt;You can also specify any other value which will be used as the value of the target property on all links.&lt;br /&gt;&lt;br /&gt;/*** open links in the current window*/&lt;br /&gt;&lt;br /&gt;var options = {&lt;br /&gt;linkTarget : GSearch.LINK_TARGET_SELF&lt;br /&gt;};&lt;br /&gt;map.addControl(new google.maps.LocalSearch(options));  &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Custom Search Form Hint Text&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When the search control is in its idle state, the search form normally contains localized&lt;br /&gt;search hint text, e.g.: "search the map". Using this option, you can supply your own custom hint&lt;br /&gt;text.&lt;br /&gt;&lt;br /&gt;var options = {&lt;br /&gt;searchFormHint : "Example Searches: Hotels in New York City"&lt;br /&gt;};&lt;br /&gt;map.addControl(new google.maps.LocalSearch(options));&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Idle and Search Completion Callbacks&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In some cases, its useful for an application to know when a search has completed and when the earch control goes idle. For instance, when the search control goes idle, the application may want to recenter the map. When a search completes, an application may want to alter the zoom level of the map. These are easily accomplished by using the search control callbacks.&lt;br /&gt;Search Control Idle Callback&lt;br /&gt;The search control idle callback is called when the search control finishes its initial load and whenever search results are dismissed. The following snippet demonstrates how to use this.&lt;br /&gt;&lt;br /&gt;// request an "on idle" callback. This is called when a search is dismissed and&lt;br /&gt;// when the search control initially loads&lt;br /&gt;var options = {&lt;br /&gt;onIdleCallback : function() { alert("search control is idle");}&lt;br /&gt;};&lt;br /&gt;map.addControl(new google.maps.LocalSearch(options));  &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Search Complete Callback&lt;/span&gt;&lt;br /&gt;The search complete callback is called whenever a search completes. It is passed the localSearch object associated with the search control. It is called before results are placed on the map or into the tabular results list. The following snippet demonstrates how to use this.&lt;br /&gt;&lt;br /&gt;// request an "on search complete" callback. This is called when a search completes&lt;br /&gt;// and before results are placed on the map or tabular tabular result list&lt;br /&gt;var options = {&lt;br /&gt;onSearchCompleteCallback : function(searcher){&lt;br /&gt;                          alert(searcher.results.length + " results");&lt;br /&gt;                         }&lt;br /&gt;};&lt;br /&gt;map.addControl(new google.maps.LocalSearch(options));  &lt;br /&gt;&lt;br /&gt;Marker Html Generation and Markers Set CallbacksNew!&lt;br /&gt;&lt;br /&gt;The callbacks listed above give your application basic notifications that a search has completed&lt;br /&gt;and that the user is done using the control. The marker oriented callbacks described in this section are designed to allow you to participate in the html generation phase of a search result's&lt;br /&gt;info window as well as providing you with direct access to the markers once they have been placed on the map.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Generate Marker HTML Callback&lt;/span&gt;&lt;br /&gt;When the info window for a marker representing a search result is opened, this callback is executed in order to allow you to participate in the html generation. For instance, suppose you want to add a link to the info window, or add a photo, or whatever makes sense for your application. The following snippet shows how to do this.&lt;br /&gt;&lt;br /&gt;// request an "on generate marker html" callback. This is called during the open of an info window.&lt;br /&gt;var options = {&lt;br /&gt;onGenerateMarkerHtmlCallback : extendMarker&lt;br /&gt;};&lt;br /&gt;map.addControl(new google.maps.LocalSearch(options));&lt;br /&gt;...&lt;br /&gt;function extendMarker(marker, html, result) {&lt;br /&gt;// extend the passed in html for this result&lt;br /&gt;myStuff = document.createElement("div");&lt;br /&gt;div.innerHTML = "Bookmark This Result...";&lt;br /&gt;html.appendChild(div);&lt;br /&gt;return html;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Markers Set Callback&lt;/span&gt;&lt;br /&gt;The Search Complete callback calls your application before the search results are converted into markers and placed on the map. This allows your application to inspect and process the raw results. The onMarkersSetCallback calls your application after the search complete callback, and after the results are processed and placed on the map. This callback allows you to inspect and&lt;br /&gt;process the markers, etc. The sample below demonstrates this callback. Normally, after a search completes, the first marker's info window is opened. Using this callback, you can open an alternate info window (maybe the info window of one of your partners, etc.)&lt;br /&gt;// request an "on markers set" callback.&lt;br /&gt;&lt;br /&gt;var options = {&lt;br /&gt;onMarkersSetCallback : markersSet&lt;br /&gt;};&lt;br /&gt;myLocalSearchControl = new google.maps.LocalSearch(options);&lt;br /&gt;map.addControl(myLocalSearchControl);&lt;br /&gt;...&lt;br /&gt;function markersSet(markers) {&lt;br /&gt;// note: markers is an array of LocalResult&lt;br /&gt;if (markers.length &amp;gt; 1) {&lt;br /&gt;// grab the title of the 2nd result object&lt;br /&gt;// if it matches starbucks, then alert&lt;br /&gt;var title = markers[1].result.titleNoFormatting;&lt;br /&gt;if (title.search(/starbucks/i) &amp;gt;= 0) {&lt;br /&gt;alert(markers[1].result.titleNoFormatting);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Setting Focus on the Search Control&lt;/span&gt;&lt;br /&gt;Applications may use the focus() method on the search control to force focus to the search form's input box.&lt;br /&gt;&lt;br /&gt;var searchControl = new google.maps.LocalSearch();&lt;br /&gt;map.addControl(searchControl);&lt;br /&gt;...&lt;br /&gt;searchControl.focus(); &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;First Result Info Window Suppression&lt;/span&gt;&lt;br /&gt;Normally, when a search completes, the first search result is selected, the map is panned to this&lt;br /&gt;result, and the info window associated with the result is opened. This option allows an application to suppress this initial info window open.&lt;br /&gt;&lt;br /&gt;// request the the initial search result info window should not be&lt;br /&gt;// auto-opened&lt;br /&gt;var options = {&lt;br /&gt;suppressInitialResultSelection : true&lt;br /&gt;};&lt;br /&gt;map.addControl(new google.maps.LocalSearch(options)); &lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-family: lucida grande;"&gt;Suppress Default Zoom on Search CompleteNew!&lt;/span&gt;&lt;br /&gt;Normally, when a search completes, the map is re-positioned and zoomed in so that it shows all of the results. Applications can disable this move/zoom operation by setting the suppressZoomToBounds option to false. The HotLinks sample demonstrates this. The other interesting thing this sample does is demonstrate how to use the search control's .execute() method to do initiate a search from your own code. Note the Featured Locations links beneath the map.&lt;br /&gt;&lt;br /&gt;// instruct the system to NOT zoom on search complete&lt;br /&gt;var options = {&lt;br /&gt;suppressZoomToBounds : true&lt;br /&gt;};&lt;br /&gt;map.addControl(new google.maps.LocalSearch(options));&lt;br /&gt;&lt;br /&gt;The "Hello World" of the Local Search Control for Google Maps&lt;br /&gt;&lt;br /&gt;The following page demonstrates a complete page which uses the Local Search Control&lt;br /&gt;for Google Maps. You can start with this simple page, change YOUR-KEY to the value of&lt;br /&gt;your key and be up and running in seconds.&lt;br /&gt;&lt;br /&gt;Warning: Make sure you signup for your own key. Do not use the key value of "YOUR-KEY" on your pages.&lt;br /&gt;&lt;br /&gt;&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;meta http-equiv="content-type"&lt;br /&gt;content="text/html; charset=utf-8"/&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;Local Search Control for Google Maps -&lt;br /&gt;default.html&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;script src="http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;key=&lt;br /&gt;ABQIAAAAipgi6ppj9z1Np5lR2SFXbBSMWlLVwX1ylsLSaLe34pMM37gB9hQjNUQFvLuLRgiSMzRlZIgxSIE1vw" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script src="http://www.google.com/uds/api?file=uds.js&amp;amp;&lt;br /&gt;v=1.0&amp;amp;key=YOUR-KEY" type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script src="http://www.google.com/uds/solutions/localsearch/gmlocalsearch.js"&lt;br /&gt;type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;style type="text/css"&amp;gt;&lt;br /&gt;@import url("http://www.google.com/uds/css/gsearch.css");&lt;br /&gt;@import url("http://www.google.com/uds/solutions/localsearch&lt;br /&gt;/gmlocalsearch.css");&lt;br /&gt;#map {&lt;br /&gt;border : 1px solid #979797;&lt;br /&gt;width : 100%;&lt;br /&gt;height : 600px;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;//&amp;lt;![CDATA[&lt;br /&gt;function load() {&lt;br /&gt;if (GBrowserIsCompatible()) {&lt;br /&gt;  // Create and Center a Map&lt;br /&gt;  var map = new GMap2(document.getElementById("map"));&lt;br /&gt;  map.setCenter(new GLatLng(12.4419, 79.1419), 13);&lt;br /&gt;  map.addControl(new GLargeMapControl());&lt;br /&gt;  map.addControl(new GMapTypeControl());&lt;br /&gt;  // bind a search control to the map, suppress result list&lt;br /&gt;  map.addControl(new google.maps.LocalSearch());&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;GSearch.setOnLoadCallback(load);&lt;br /&gt;//]]&amp;gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body onunload="GUnload()"&amp;gt;&lt;br /&gt;&amp;lt;div id="map"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&amp;gt;&lt;br /&gt;&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;meta http-equiv="content-type"&lt;br /&gt;content="text/html; charset=utf-8"/&amp;gt;&lt;br /&gt;&amp;lt;title&amp;gt;Local Search Control for Google Maps -&lt;br /&gt;default.html&amp;lt;/title&amp;gt;&lt;br /&gt;&amp;lt;script src="http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;key=&lt;br /&gt;ABQIAAAAipgi6ppj9z1Np5lR2SFXbBSMWlLVwX1ylsLSaLe34pMM37gB9hQjNUQFvLuLRgiSMzRlZIgxSIE1vw"&lt;br /&gt;type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;//&amp;lt;![CDATA[&lt;br /&gt;google.load("search", "1");&lt;br /&gt; function OnLoad() {&lt;br /&gt;   // Create a search control&lt;br /&gt;   var searchControl = new google.search.SearchControl();&lt;br /&gt;   // Add in a full set of searchers&lt;br /&gt;   var localSearch = new google.search.LocalSearch();&lt;br /&gt;   searchControl.addSearcher(localSearch);&lt;br /&gt;   searchControl.addSearcher(new google.search.WebSearch());&lt;br /&gt;   searchControl.addSearcher(new google.search.VideoSearch());&lt;br /&gt;   searchControl.addSearcher(new google.search.BlogSearch());&lt;br /&gt;   // Set the Local Search center point&lt;br /&gt;   localSearch.setCenterPoint("India, India");&lt;br /&gt;   // Tell the searcher to draw itself and tell it where to attach&lt;br /&gt;   searchControl.draw(document.getElementById("searchcontrol"));&lt;br /&gt;   // Execute an inital search&lt;br /&gt;   searchControl.execute("Google");&lt;br /&gt; }&lt;br /&gt; google.setOnLoadCallback(OnLoad);&amp;gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body onunload="GUnload()"&amp;gt;&lt;br /&gt;&amp;lt;div id="searchcontrol"&amp;gt;Loading...&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-7563081831491812306?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/7563081831491812306/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2009/01/local-search-control-programming-guide.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/7563081831491812306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/7563081831491812306'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2009/01/local-search-control-programming-guide.html' title='Local Search Control Programming Guide in Google API  - Local Search Control for Google Maps'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-5342555885389627926</id><published>2009-01-19T17:44:00.000+05:30</published><updated>2009-01-19T17:47:17.628+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Function arguments in PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='Function arguments'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>Function arguments in PHP</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Function arguments&lt;/span&gt;&lt;br /&gt;Information may be passed to functions via the argument list, which is a comma-delimited list of expressions.&lt;br /&gt;&lt;br /&gt;PHP supports passing arguments by value (the default), passing by reference, and default argument values. Variable-length argument lists are also supported, see also the function references for func_num_args(), func_get_arg(), and func_get_args() for more information.&lt;br /&gt;&lt;br /&gt;Example  Passing arrays to functions&lt;br /&gt;&lt;br /&gt;Making arguments be passed by reference&lt;br /&gt;By default, function arguments are passed by value (so that if the value of the argument within the function is changed, it does not get changed outside of the function). To allow a function to modify its arguments, they must be passed by reference.&lt;br /&gt;&lt;br /&gt;To have an argument to a function always passed by reference, prepend an ampersand (&amp;amp;) to the argument name in the function definition:&lt;br /&gt;&lt;br /&gt;Example Passing function parameters by reference&lt;br /&gt;&lt;br /&gt;Default argument values&lt;br /&gt;A function may define C++-style default values for scalar arguments as follows:&lt;br /&gt;&lt;br /&gt;Example Use of default parameters in functions&lt;br /&gt;&lt;br /&gt;The output from the above snippet is:&lt;br /&gt;&lt;br /&gt;Making a cup of cappuccino.&lt;br /&gt;Making a cup of .&lt;br /&gt;Making a cup of espresso.&lt;br /&gt;   &lt;br /&gt;PHP also allows the use of arrays and the special type NULL as default values, for example:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Example Using non-scalar types as default values&lt;br /&gt;&lt;br /&gt;The default value must be a constant expression, not (for example) a variable, a class member or a function call.&lt;br /&gt;&lt;br /&gt;Note that when using default arguments, any defaults should be on the right side of any non-default arguments; otherwise, things will not work as expected. Consider the following code snippet:&lt;br /&gt;&lt;br /&gt;Example Incorrect usage of default function arguments&lt;br /&gt;&lt;br /&gt;The output of the above example is:&lt;br /&gt;&lt;br /&gt;Warning: Missing argument 2 in call to makeyogurt() in&lt;br /&gt;/usr/local/etc/httpd/htdocs/phptest/functest.html on line 41&lt;br /&gt;Making a bowl of raspberry .&lt;br /&gt;   &lt;br /&gt;Now, compare the above with this:&lt;br /&gt;&lt;br /&gt;Example Correct usage of default function arguments&lt;br /&gt;&lt;br /&gt;The output of this example is:&lt;br /&gt;&lt;br /&gt;Making a bowl of acidophilus raspberry.&lt;br /&gt;   &lt;br /&gt;Note: As of PHP 5, default values may be passed by reference.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Variable-length argument lists&lt;/span&gt;&lt;br /&gt;PHP 4 and above has support for variable-length argument lists in user-defined functions. This is really quite easy, using the func_num_args(), func_get_arg(), and func_get_args() functions.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-5342555885389627926?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/5342555885389627926/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2009/01/function-arguments-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/5342555885389627926'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/5342555885389627926'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2009/01/function-arguments-in-php.html' title='Function arguments in PHP'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-3515585488534548020</id><published>2009-01-19T17:43:00.000+05:30</published><updated>2009-01-19T17:44:54.690+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='Variable functions in PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>Variable functions in PHP</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Variable functions&lt;/span&gt;&lt;br /&gt;PHP supports the concept of variable functions. This means that if a variable name has parentheses appended to it, PHP will look for a function with the same name as whatever the variable evaluates to, and will attempt to execute it. Among other things, this can be used to implement callbacks, function tables, and so forth.&lt;br /&gt;&lt;br /&gt;Variable functions won't work with language constructs such as echo(), print(), unset(), isset(), empty(), include(), require() and the like. Utilize wrapper functions to make use of any of these constructs as variable functions.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Example Variable function example&lt;br /&gt;&lt;br /&gt;\n";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function bar($arg = '')&lt;br /&gt;{&lt;br /&gt;   echo "In bar(); argument was '$arg'.&lt;br /&gt;\n";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// This is a wrapper function around echo&lt;br /&gt;function echoit($string)&lt;br /&gt;{&lt;br /&gt;   echo $string;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;$func = 'foo';&lt;br /&gt;$func();        // This calls foo()&lt;br /&gt;&lt;br /&gt;$func = 'bar';&lt;br /&gt;$func('test');  // This calls bar()&lt;br /&gt;&lt;br /&gt;$func = 'echoit';&lt;br /&gt;$func('test');  // This calls echoit()&lt;br /&gt;?&gt;&lt;br /&gt;&lt;br /&gt;An object method can also be called with the variable functions syntax.&lt;br /&gt;&lt;br /&gt;Example Variable method example&lt;br /&gt;&lt;br /&gt;$name(); // This calls the Bar() method&lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;   function Bar()&lt;br /&gt;   {&lt;br /&gt;       echo "This is Bar";&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;$foo = new Foo();&lt;br /&gt;$funcname = "Variable";&lt;br /&gt;$foo-&gt;$funcname();  // This calls $foo-&gt;Variable()&lt;br /&gt;&lt;br /&gt;?&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-3515585488534548020?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/3515585488534548020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2009/01/variable-functions-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/3515585488534548020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/3515585488534548020'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2009/01/variable-functions-in-php.html' title='Variable functions in PHP'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-8730575893373278206</id><published>2009-01-19T17:40:00.000+05:30</published><updated>2009-01-19T17:42:50.409+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Declare Control Structure in php'/><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>Declare Control Structure in PHP</title><content type='html'>&lt;span style="font-weight:bold;"&gt;declare&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The declare construct is used to set execution directives for a block of code. The syntax of declare is similar to the syntax of other flow control constructs:&lt;br /&gt;&lt;br /&gt;declare (directive)&lt;br /&gt;    statement&lt;br /&gt;&lt;br /&gt;The directive section allows the behavior of the declare block to be set. Currently only two directives are recognized: the ticks directive (See below for more information on the ticks directive) and the encoding directive (See below for more information on the encoding directive).&lt;br /&gt;&lt;br /&gt;The statement part of the declare block will be executed - how it is executed and what side effects occur during execution may depend on the directive set in the directive block.&lt;br /&gt;&lt;br /&gt;The declare construct can also be used in the global scope, affecting all code following it (however if the file with declare was included then it does not affect the parent file).&lt;br /&gt;&lt;?php&lt;br /&gt;// these are the same:&lt;br /&gt;&lt;br /&gt;// you can use this:&lt;br /&gt;declare(ticks=1) {&lt;br /&gt;    // entire script here&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// or you can use this:&lt;br /&gt;declare(ticks=1);&lt;br /&gt;// entire script here&lt;br /&gt;?&gt;&lt;br /&gt;&lt;br /&gt;As of PHP 5.3.0 ticks are deprecated and will be removed in PHP 6.0.0.&lt;br /&gt;&lt;br /&gt;A tick is an event that occurs for every N low-level statements executed by the parser within the declare block. The value for N is specified using ticks=N within the declare blocks's directive section.&lt;br /&gt;&lt;br /&gt;The event(s) that occur on each tick are specified using the register_tick_function(). See the example below for more details. Note that more than one event can occur for each tick.&lt;br /&gt;&lt;br /&gt;Example #1 Profile a section of PHP code&lt;br /&gt;&lt;?php&lt;br /&gt;// A function that records the time when it is called&lt;br /&gt;function profile($dump = FALSE)&lt;br /&gt;{&lt;br /&gt;    static $profile;&lt;br /&gt;&lt;br /&gt;    // Return the times stored in profile, then erase it&lt;br /&gt;    if ($dump) {&lt;br /&gt;        $temp = $profile;&lt;br /&gt;        unset($profile);&lt;br /&gt;        return $temp;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    $profile[] = microtime();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Set up a tick handler&lt;br /&gt;register_tick_function("profile");&lt;br /&gt;&lt;br /&gt;// Initialize the function before the declare block&lt;br /&gt;profile();&lt;br /&gt;&lt;br /&gt;// Run a block of code, throw a tick every 2nd statement&lt;br /&gt;declare(ticks=2) {&lt;br /&gt;    for ($x = 1; $x &lt; 50; ++$x) {&lt;br /&gt;        echo similar_text(md5($x), md5($x*$x)), "&lt;br /&gt;;";&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Display the data stored in the profiler&lt;br /&gt;print_r(profile(TRUE));&lt;br /&gt;?&gt;&lt;br /&gt;&lt;br /&gt;The example profiles the PHP code within the 'declare' block, recording the time at which every second low-level statement in the block was executed. This information can then be used to find the slow areas within particular segments of code. This process can be performed using other methods: using ticks is more convenient and easier to implement.&lt;br /&gt;&lt;br /&gt;Ticks are well suited for debugging, implementing simple multitasking, background I/O and many other tasks.&lt;br /&gt;&lt;br /&gt;See also register_tick_function() and unregister_tick_function().&lt;br /&gt;Encoding&lt;br /&gt;&lt;br /&gt;A script's encoding can be specified per-script using the encoding directive.&lt;br /&gt;&lt;br /&gt;Example #2 Declaring an encoding for the script.&lt;br /&gt;&lt;?php&lt;br /&gt;declare(encoding='ISO-8859-1');&lt;br /&gt;// code here&lt;br /&gt;?&gt;&lt;br /&gt;Caution&lt;br /&gt;&lt;br /&gt;When combined with namespaces, the only legal syntax for declare is declare(encoding='...'); where ... is the encoding value. declare(encoding='...') {} will result in a parse error when combined with namespaces.&lt;br /&gt;&lt;br /&gt;The encoding declare value is ignored in PHP 5.3 unless php is compiled with --enable-zend-multibyte. In PHP 6.0, the encoding directive will be used to inform the scanner what encoding the file is created in. Legal values are encoding names such as UTF-8.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-8730575893373278206?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/8730575893373278206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2009/01/declare-control-structure-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/8730575893373278206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/8730575893373278206'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2009/01/declare-control-structure-in-php.html' title='Declare Control Structure in PHP'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-7802152090610787553</id><published>2009-01-19T17:37:00.000+05:30</published><updated>2009-01-19T17:40:10.151+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='Internal (built-in) functions'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>Internal (built-in) functions in PHP</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Internal (built-in) functions&lt;/span&gt;&lt;br /&gt;PHP comes standard with many functions and constructs. There are also functions that require specific PHP extensions compiled in, otherwise fatal "undefined function" errors will appear. For example, to use image functions such as imagecreatetruecolor(), PHP must be compiled with GD support. Or, to use mysql_connect(), PHP must be compiled with MySQL support. There are many core functions that are included in every version of PHP, such as the string and variable functions. A call to phpinfo() or get_loaded_extensions() will show which extensions are loaded into PHP. Also note that many extensions are enabled by default and that the PHP manual is split up by extension. See the configuration, installation, and individual extension chapters, for information on how to set up PHP.&lt;br /&gt;&lt;br /&gt;Reading and understanding a function's prototype is explained within the manual section titled how to read a function definition. It's important to realize what a function returns or if a function works directly on a passed in value. For example, str_replace() will return the modified string while usort() works on the actual passed in variable itself. Each manual page also has specific information for each function like information on function parameters, behavior changes, return values for both success and failure, and availability information. Knowing these important (yet often subtle) differences is crucial for writing correct PHP code.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-7802152090610787553?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/7802152090610787553/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2009/01/internal-built-in-functions-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/7802152090610787553'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/7802152090610787553'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2009/01/internal-built-in-functions-in-php.html' title='Internal (built-in) functions in PHP'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-2596953315110252156</id><published>2009-01-19T17:30:00.001+05:30</published><updated>2009-01-19T17:37:26.487+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='Predefined variables'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>Predefined variables in PHP</title><content type='html'>&lt;h1 class="title"&gt;Predefined variables&lt;/h1&gt; &lt;div class="partintro"&gt; &lt;p class="para"&gt;PHP provides a large number of predefined variables to all  scripts. The variables represent everything from &lt;span class="link"&gt;external variables&lt;/span&gt; to built-in  environment variables, last error messages to last retrieved headers. &lt;/p&gt; &lt;p class="para"&gt;See also the FAQ titled "How does register_globals affect  me?" &lt;/p&gt;&lt;/div&gt; &lt;h2&gt;Contents&lt;/h2&gt; &lt;ul class="chunklist chunklist_reference"&gt;&lt;li&gt;Superglobals —  Superglobals are built-in variables that are always available in all scopes &lt;/li&gt;&lt;li&gt;$GLOBALS — References all  variables available in global scope &lt;/li&gt;&lt;li&gt;$_SERVER — Server and execution  environment information &lt;/li&gt;&lt;li&gt;$_GET — HTTP GET variables &lt;/li&gt;&lt;li&gt;$_POST — HTTP POST variables &lt;/li&gt;&lt;li&gt;$_FILES — HTTP File Upload  variables &lt;/li&gt;&lt;li&gt;$_REQUEST — HTTP Request  variables &lt;/li&gt;&lt;li&gt;$_SESSION — Session variables &lt;/li&gt;&lt;li&gt;$_ENV — Environment  variables &lt;/li&gt;&lt;li&gt;$_COOKIE — HTTP Cookies &lt;/li&gt;&lt;li&gt;$php_errormsg — The  previous error message &lt;/li&gt;&lt;li&gt;$HTTP_RAW_POST_DATA —  Raw POST data &lt;/li&gt;&lt;li&gt;$http_response_header —  HTTP response headers &lt;/li&gt;&lt;li&gt;$argc — The number of arguments  passed to script &lt;/li&gt;&lt;li&gt;$argv — Array of arguments passed  to script&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-2596953315110252156?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/2596953315110252156/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2009/01/predefined-variables-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/2596953315110252156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/2596953315110252156'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2009/01/predefined-variables-in-php.html' title='Predefined variables in PHP'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-1923202076094230705</id><published>2009-01-19T17:26:00.000+05:30</published><updated>2009-01-19T17:30:15.447+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><category scheme='http://www.blogger.com/atom/ns#' term='Extending Exceptions'/><category scheme='http://www.blogger.com/atom/ns#' term='css'/><title type='text'>Extending Exceptions in PHP</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Exceptions&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Extending Exceptions&lt;/span&gt;&lt;br /&gt;PHP 5 has an exception model similar to that of other programming languages. An exception can be thrown, and caught ("catched") within PHP. Code may be surrounded in a try block, to facilitate the catching of potential exceptions. Each try must have at least one corresponding catch block. Multiple catch blocks can be used to catch different classes of exeptions. Normal execution (when no exception is thrown within the try block, or when a catch matching the thrown exception's class is not present) will continue after that last catch block defined in sequence. Exceptions can be thrown (or re-thrown) within a catch block.&lt;br /&gt;&lt;br /&gt;When an exception is thrown, code following the statement will not be executed, and PHP will attempt to find the first matching catch block. If an exception is not caught, a PHP Fatal Error will be issued with an "Uncaught Exception ..." message, unless a handler has been defined with set_exception_handler().&lt;br /&gt;&lt;br /&gt;Note: Internal PHP functions mainly use Error reporting, only modern Object oriented extensions use exceptions. However, errors can be simply translated to exceptions with ErrorException.&lt;br /&gt;&lt;br /&gt;Example Throwing an Exception&lt;br /&gt;&lt;br /&gt;getMessage(), "\n";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Continue execution&lt;br /&gt;echo 'Hello World';&lt;br /&gt;?&gt;&lt;br /&gt;The above example will output:&lt;br /&gt;&lt;br /&gt;0.2&lt;br /&gt;Caught exception: Division by zero.&lt;br /&gt;Hello World&lt;br /&gt;&lt;br /&gt;   Example Nested Exception&lt;br /&gt;&lt;br /&gt;getMessage());&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;$foo = new Test;&lt;br /&gt;$foo-&gt;testing();&lt;br /&gt;&lt;br /&gt;?&gt;&lt;br /&gt;The above example will output:&lt;br /&gt;&lt;br /&gt;string(4) "foo!"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-1923202076094230705?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/1923202076094230705/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2009/01/extending-exceptions-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/1923202076094230705'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/1923202076094230705'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2009/01/extending-exceptions-in-php.html' title='Extending Exceptions in PHP'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-1949714508483718570</id><published>2008-12-30T17:21:00.000+05:30</published><updated>2008-12-30T17:23:47.522+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='sleep'/><category scheme='http://www.blogger.com/atom/ns#' term='set state'/><category scheme='http://www.blogger.com/atom/ns#' term='tostring'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='overloading in php'/><category scheme='http://www.blogger.com/atom/ns#' term='wakeup'/><title type='text'>Magic Methods, __sleep , __wakeup, __toString, __set_state in PHP</title><content type='html'>&lt;h2 class="title"&gt;Magic Methods&lt;/h2&gt; &lt;p class="para"&gt;The function names &lt;i&gt;__construct&lt;/i&gt;, &lt;i&gt;__destruct&lt;/i&gt; (see &lt;a class="link" href="language.oop5.decon.html"&gt;Constructors and Destructors&lt;/a&gt;),  &lt;i&gt;__call&lt;/i&gt;, &lt;i&gt;__callStatic&lt;/i&gt;, &lt;i&gt;__get&lt;/i&gt;, &lt;i&gt;__set&lt;/i&gt;, &lt;i&gt;__isset&lt;/i&gt;,  &lt;i&gt;__unset&lt;/i&gt; (see &lt;a class="link" href="language.oop5.overloading.html"&gt;Overloading&lt;/a&gt;), &lt;i&gt;__sleep&lt;/i&gt;,  &lt;i&gt;__wakeup&lt;/i&gt;, &lt;i&gt;__toString&lt;/i&gt;, &lt;i&gt;__set_state&lt;/i&gt; and &lt;a class="link" href="language.oop5.cloning.html"&gt;__clone&lt;/a&gt; are magical in PHP classes. You  cannot have functions with these names in any of your classes unless you want  the magic functionality associated with them&lt;/p&gt;&lt;br /&gt;&lt;p class="para"&gt;&lt;br /&gt;&lt;/p&gt;&lt;h3 class="title"&gt;&lt;i&gt;__sleep&lt;/i&gt; and &lt;i&gt;__wakeup&lt;/i&gt;&lt;/h3&gt; &lt;p class="para"&gt;&lt;a class="function" href="function.serialize.html"&gt;serialize()&lt;/a&gt;  checks if your class has a function with the magic name &lt;i&gt;__sleep&lt;/i&gt;. If so,  that function is executed prior to any serialization. It can clean up the object  and is supposed to return an array with the names of all variables of that  object that should be serialized. If the method doesn't return anything then  &lt;b&gt;&lt;tt&gt;NULL&lt;/tt&gt;&lt;/b&gt; is serialized and E_NOTICE is issued. &lt;/p&gt; &lt;p class="para"&gt;The intended use of &lt;i&gt;__sleep&lt;/i&gt; is to commit pending data or  perform similar cleanup tasks. Also, the function is useful if you have very  large objects which do not need to be saved completely. &lt;/p&gt; &lt;p class="para"&gt;Conversely, &lt;a class="function" href="function.unserialize.html"&gt;unserialize()&lt;/a&gt; checks for the presence of a  function with the magic name &lt;i&gt;__wakeup&lt;/i&gt;. If present, this function can  reconstruct any resources that the object may have. &lt;/p&gt; &lt;p class="para"&gt;The intended use of &lt;i&gt;__wakeup&lt;/i&gt; is to reestablish any database  connections that may have been lost during serialization and perform other  reinitialization tasks.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;div class="phpcode"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;class &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;Connection &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;{&lt;br /&gt;    protected &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$link&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;    private &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$server&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$username&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$password&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$db&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;   &lt;br /&gt;    public function &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;__construct&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$server&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$username&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$password&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$db&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;)&lt;br /&gt;    {&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;server &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$server&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;username &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$username&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;password &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$password&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;db &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$db&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;connect&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;();&lt;br /&gt;    }&lt;br /&gt;   &lt;br /&gt;    private function &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;connect&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;()&lt;br /&gt;    {&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;link &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;mysql_connect&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;server&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;username&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;password&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;mysql_select_db&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;db&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;link&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;    }&lt;br /&gt;   &lt;br /&gt;    public function &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;__sleep&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;()&lt;br /&gt;    {&lt;br /&gt;        return array(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'server'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'username'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'password'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'db'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;    }&lt;br /&gt;   &lt;br /&gt;    public function &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;__wakeup&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;()&lt;br /&gt;    {&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;connect&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;?&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;div class="sect2" id="language.oop5.magic.tostring"&gt; &lt;h3 class="title"&gt;&lt;i&gt;__toString&lt;/i&gt;&lt;/h3&gt; &lt;p class="para"&gt;The &lt;i&gt;__toString&lt;/i&gt; method allows a class to decide how it will  react when it is converted to a string. &lt;/p&gt; &lt;div class="example"&gt; &lt;p&gt;&lt;b&gt;Simple example&lt;/b&gt;&lt;/p&gt; &lt;div class="example-contents"&gt; &lt;div class="phpcode"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;// Declare a simple class&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;class &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;TestClass&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;{&lt;br /&gt;    public &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$foo&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;&lt;br /&gt;    public function &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;__construct&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$foo&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;) {&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;foo &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$foo&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public function &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;__toString&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;() {&lt;br /&gt;        return &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;foo&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$class &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= new &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;TestClass&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'Hello'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;echo &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$class&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;?&gt;&lt;/span&gt;  &lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/div&gt; &lt;div class="example-contents"&gt; &lt;p&gt;The above example will output:&lt;/p&gt;&lt;/div&gt; &lt;div class="example-contents"&gt;&lt;pre&gt;&lt;div class="cdata"&gt;&lt;pre&gt;Hello&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;It is worth noting that before PHP 5.2.0 the &lt;i&gt;__toString&lt;/i&gt;  method was only called when it was directly combined with &lt;a class="function" href="function.echo.html"&gt;echo()&lt;/a&gt; or &lt;a class="function" href="function.print.html"&gt;print()&lt;/a&gt;. Since PHP 5.2.0, it is called in any  string context (e.g. in &lt;a class="function" href="function.printf.html"&gt;printf()&lt;/a&gt; with &lt;i&gt;%s&lt;/i&gt; modifier) but not in  other types contexts (e.g. with &lt;i&gt;%d&lt;/i&gt; modifier). Since PHP 5.2.0, converting  objects without &lt;i&gt;__toString&lt;/i&gt; method to string would cause  &lt;b&gt;&lt;tt&gt;E_RECOVERABLE_ERROR&lt;/tt&gt;&lt;/b&gt;. &lt;/pre&gt;&lt;/div&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="sect2" id="language.oop5.magic.set-state"&gt; &lt;h3 class="title"&gt;&lt;i&gt;__set_state&lt;/i&gt;&lt;/h3&gt; &lt;p class="para"&gt;This &lt;a class="link" href="language.oop5.static.html"&gt;static&lt;/a&gt;  method is called for classes exported by &lt;a class="function" href="function.var-export.html"&gt;var_export()&lt;/a&gt; since PHP 5.1.0. &lt;/p&gt; &lt;p&gt;The only parameter of this method is an array containing exported  properties in the form &lt;i&gt;array('property' =&gt; value, ...)&lt;/i&gt;.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Using &lt;i&gt;__set_state&lt;/i&gt; (since PHP 5.1.0)&lt;/b&gt;&lt;/p&gt; &lt;div class="example"&gt;  &lt;div class="example-contents"&gt; &lt;div class="phpcode"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;?php&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;class &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;A&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;{&lt;br /&gt;    public &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$var1&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;    public &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$var2&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;&lt;br /&gt;    public static function &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;__set_state&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$an_array&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;) &lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;// As of PHP 5.1.0&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;{&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$obj &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= new &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;A&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$obj&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;var1 &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$an_array&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;[&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'var1'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;];&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$obj&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;var2 &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$an_array&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;[&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'var2'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;];&lt;br /&gt;        return &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$obj&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$a &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= new &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;A&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$a&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;var1 &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;5&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$a&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;var2 &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'foo'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;&lt;br /&gt;eval(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'$b = ' &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;. &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;var_export&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$a&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;true&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;) . &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;';'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;); &lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;// $b = A::__set_state(array(&lt;br /&gt;                                            //    'var1' =&gt; 5,&lt;br /&gt;                                            //    'var2' =&gt; 'foo',&lt;br /&gt;                                            // ));&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;var_dump&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$b&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;?&gt;&lt;/span&gt; &lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/div&gt; &lt;div class="example-contents"&gt; &lt;p&gt;The above example will output:&lt;/p&gt;&lt;/div&gt; &lt;div class="example-contents"&gt;&lt;pre&gt;&lt;div class="cdata"&gt;&lt;pre&gt;object(A)#2 (2) {&lt;br /&gt; ["var1"]=&gt;&lt;br /&gt; int(5)&lt;br /&gt; ["var2"]=&gt;&lt;br /&gt; string(3) "foo"&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;p class="para"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="para"&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-1949714508483718570?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/1949714508483718570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2008/12/magic-methods-sleep-wakeup-tostring.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/1949714508483718570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/1949714508483718570'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2008/12/magic-methods-sleep-wakeup-tostring.html' title='Magic Methods, __sleep , __wakeup, __toString, __set_state in PHP'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-4235190759119702645</id><published>2008-12-30T17:19:00.000+05:30</published><updated>2008-12-30T17:20:49.102+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='cloning'/><category scheme='http://www.blogger.com/atom/ns#' term='php  object'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='clone'/><category scheme='http://www.blogger.com/atom/ns#' term='php object clone'/><title type='text'>Object cloning in PHP</title><content type='html'>&lt;h2 class="title"&gt;Object cloning&lt;/h2&gt; &lt;p class="para"&gt;Creating a copy of an object with fully replicated properties is  not always the wanted behavior. A good example of the need for copy  constructors, is if you have an object which represents a GTK window and the  object holds the resource of this GTK window, when you create a duplicate you  might want to create a new window with the same properties and have the new  object hold the resource of the new window. Another example is if your object  holds a reference to another object which it uses and when you replicate the  parent object you want to create a new instance of this other object so that the  replica has its own separate copy. &lt;/p&gt; &lt;p class="para"&gt;An object copy is created by using the clone keyword (which calls  the object's __clone() method if possible). An object's __clone() method cannot  be called directly. &lt;/p&gt; &lt;div class="informalexample"&gt; &lt;div class="example-contents"&gt; &lt;div class="cdata"&gt;&lt;pre&gt;$copy_of_object = clone $object;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt; &lt;p class="para"&gt;When an object is cloned, PHP 5 will perform a shallow copy of all  of the object's properties. Any properties that are references to other  variables, will remain references. If a __clone() method is defined, then the  newly created object's __clone() method will be called, to allow any necessary  properties that need to be changed. &lt;/p&gt; &lt;div class="example"&gt; &lt;p&gt;&lt;b&gt;Cloning an object&lt;/b&gt;&lt;/p&gt; &lt;div class="example-contents"&gt; &lt;div class="phpcode"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;class &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;SubObject&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;{&lt;br /&gt;    static &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$instances &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;0&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;    public &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$instance&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;&lt;br /&gt;    public function &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;__construct&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;() {&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;instance &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= ++&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;self&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;::&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$instances&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public function &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;__clone&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;() {&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;instance &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= ++&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;self&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;::&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$instances&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;MyCloneable&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;{&lt;br /&gt;    public &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$object1&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;    public &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$object2&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;&lt;br /&gt;    function &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;__clone&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;()&lt;br /&gt;    {&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;// Force a copy of this-&gt;object, otherwise&lt;br /&gt;        // it will point to same object.&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;object1 &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= clone &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;object1&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$obj &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= new &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;MyCloneable&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;();&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$obj&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;object1 &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= new &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;SubObject&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;();&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$obj&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;object2 &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= new &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;SubObject&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;();&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$obj2 &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= clone &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$obj&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;print(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"Original Object:\n"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;print_r&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$obj&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;&lt;br /&gt;print(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"Cloned Object:\n"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;print_r&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$obj2&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;?&gt;&lt;/span&gt; &lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/div&gt; &lt;div class="example-contents"&gt; &lt;p&gt;The above example will output:&lt;/p&gt;&lt;/div&gt; &lt;div class="example-contents"&gt;&lt;pre&gt;&lt;div class="cdata"&gt;&lt;pre&gt;Original Object:&lt;br /&gt;MyCloneable Object&lt;br /&gt;(&lt;br /&gt;   [object1] =&gt; SubObject Object&lt;br /&gt;       (&lt;br /&gt;           [instance] =&gt; 1&lt;br /&gt;       )&lt;br /&gt;&lt;br /&gt;   [object2] =&gt; SubObject Object&lt;br /&gt;       (&lt;br /&gt;           [instance] =&gt; 2&lt;br /&gt;       )&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;Cloned Object:&lt;br /&gt;MyCloneable Object&lt;br /&gt;(&lt;br /&gt;   [object1] =&gt; SubObject Object&lt;br /&gt;       (&lt;br /&gt;           [instance] =&gt; 3&lt;br /&gt;       )&lt;br /&gt;&lt;br /&gt;   [object2] =&gt; SubObject Object&lt;br /&gt;       (&lt;br /&gt;           [instance] =&gt; 2&lt;br /&gt;       )&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;  &lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5173447009686155144-4235190759119702645?l=muruganasm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://muruganasm.blogspot.com/feeds/4235190759119702645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://muruganasm.blogspot.com/2008/12/object-cloning-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/4235190759119702645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5173447009686155144/posts/default/4235190759119702645'/><link rel='alternate' type='text/html' href='http://muruganasm.blogspot.com/2008/12/object-cloning-in-php.html' title='Object cloning in PHP'/><author><name>murugan senthil</name><uri>http://www.blogger.com/profile/13698955822338278737</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://1.bp.blogspot.com/-cEDWxpstpk8/Thv1sh-locI/AAAAAAAAA3w/IP3PEdxeH_Y/s220/189791_1868505190867_1188208020_2266339_8056390_n.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5173447009686155144.post-5893167466435101385</id><published>2008-12-30T17:14:00.000+05:30</published><updated>2008-12-30T17:18:40.906+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='overload'/><category scheme='http://www.blogger.com/atom/ns#' term='overloading'/><category scheme='http://www.blogger.com/atom/ns#' term='php'/><category scheme='http://www.blogger.com/atom/ns#' term='overloading in php'/><title type='text'>Overloading in PHP</title><content type='html'>&lt;h2 class="title"&gt;Overloading&lt;/h2&gt; &lt;p class="para"&gt;Overloading in PHP provides means to dynamically "&lt;span class="quote"&gt;create&lt;/span&gt;" members and methods. These dynamic entities are  processed via magic methods one can establish in a class for various action  types. &lt;/p&gt; &lt;p class="para"&gt;The overloading methods are invoked when interacting with members  or methods that have not been declared or are not &lt;a class="link" href="language.oop5.visibility.html"&gt;visible&lt;/a&gt; in the current scope. The rest  of this section will use the terms "&lt;span class="quote"&gt;inaccessible  members&lt;/span&gt;" and "&lt;span class="quote"&gt;inaccessible methods&lt;/span&gt;" to refer to  this combination of declaration and visibility. &lt;/p&gt; &lt;p class="para"&gt;All overloading methods must be defined as &lt;i&gt;public&lt;/i&gt;. &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;b class="note"&gt;Note&lt;/b&gt;: None of the arguments of these magic methods can be  &lt;a class="link" href="functions.arguments.html#functions.arguments.by-reference"&gt;passed by  reference&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;blockquote&gt; &lt;p&gt;&lt;b class="note"&gt;Note&lt;/b&gt;: PHP's interpretation of "&lt;span class="quote"&gt;overloading&lt;/span&gt;" is different than most object oriented  languages. Overloading traditionally provides the ability to have multiple  methods with the same name but different quantities and types of arguments. &lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;div class="sect2" id="language.oop5.overloading.changelog"&gt; &lt;h3 class="title"&gt;ChangeLog&lt;/h3&gt; &lt;p class="para"&gt; &lt;table class="informaltable"&gt; &lt;thead valign="center"&gt; &lt;tr valign="center"&gt; &lt;th&gt;Version&lt;/th&gt; &lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt; &lt;tbody class="tbody" valign="center"&gt; &lt;tr valign="center"&gt; &lt;td align="left"&gt;5.1.0&lt;/td&gt; &lt;td align="left"&gt;Added &lt;i&gt;__isset()&lt;/i&gt; and &lt;i&gt;__unset()&lt;/i&gt;. &lt;/td&gt;&lt;/tr&gt; &lt;tr valign="center"&gt; &lt;td align="left"&gt;5.3.0&lt;/td&gt; &lt;td align="left"&gt;Added &lt;i&gt;__callStatic()&lt;/i&gt;. Added warning to enforce public  visibility and non-static declaration. &lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/p&gt;&lt;/div&gt; &lt;div class="sect2" id="language.oop5.overloading.members"&gt; &lt;h3 class="title"&gt;Member overloading&lt;/h3&gt; &lt;div class="methodsynopsis dc-description"&gt;&lt;span class="type"&gt;&lt;span class="type void"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class="methodname"&gt;&lt;b&gt;&lt;b&gt;__set&lt;/b&gt;&lt;/b&gt;&lt;/span&gt; ( &lt;span class="methodparam"&gt;&lt;span class="type"&gt;string&lt;/span&gt; &lt;tt class="parameter"&gt;$name&lt;/tt&gt;&lt;/span&gt; , &lt;span class="methodparam"&gt;&lt;span class="type"&gt;&lt;a class="type mixed" href="language.pseudo-types.html#language.types.mixed"&gt;mixed&lt;/a&gt;&lt;/span&gt; &lt;tt class="parameter"&gt;$value&lt;/tt&gt;&lt;/span&gt; )&lt;/div&gt; &lt;div class="methodsynopsis dc-description"&gt;&lt;span class="type"&gt;&lt;a class="type mixed" href="language.pseudo-types.html#language.types.mixed"&gt;mixed&lt;/a&gt;&lt;/span&gt; &lt;span class="methodname"&gt;&lt;b&gt;&lt;b&gt;__get&lt;/b&gt;&lt;/b&gt;&lt;/span&gt; ( &lt;span class="methodparam"&gt;&lt;span class="type"&gt;string&lt;/span&gt; &lt;tt class="parameter"&gt;$name&lt;/tt&gt;&lt;/span&gt; )&lt;/div&gt; &lt;div class="methodsynopsis dc-description"&gt;&lt;span class="type"&gt;bool&lt;/span&gt; &lt;span class="methodname"&gt;&lt;b&gt;&lt;b&gt;__isset&lt;/b&gt;&lt;/b&gt;&lt;/span&gt; ( &lt;span class="methodparam"&gt;&lt;span class="type"&gt;string&lt;/span&gt; &lt;tt class="parameter"&gt;$name&lt;/tt&gt;&lt;/span&gt; )&lt;/div&gt; &lt;div class="methodsynopsis dc-description"&gt;&lt;span class="type"&gt;&lt;span class="type void"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class="methodname"&gt;&lt;b&gt;&lt;b&gt;__unset&lt;/b&gt;&lt;/b&gt;&lt;/span&gt; ( &lt;span class="methodparam"&gt;&lt;span class="type"&gt;string&lt;/span&gt; &lt;tt class="parameter"&gt;$name&lt;/tt&gt;&lt;/span&gt; )&lt;/div&gt; &lt;p class="para"&gt;&lt;i&gt;__set()&lt;/i&gt; is run when writing data to inaccessible members.  &lt;/p&gt; &lt;p class="para"&gt;&lt;i&gt;__get()&lt;/i&gt; is utilized for reading data from inaccessible  members. &lt;/p&gt; &lt;p class="para"&gt;&lt;i&gt;__isset()&lt;/i&gt; is triggered by calling &lt;a class="function" href="function.isset.html"&gt;isset()&lt;/a&gt; or &lt;a class="function" href="function.empty.html"&gt;empty()&lt;/a&gt; on inaccessible members. &lt;/p&gt; &lt;p class="para"&gt;&lt;i&gt;__unset()&lt;/i&gt; is invoked when &lt;a class="function" href="function.unset.html"&gt;unset()&lt;/a&gt; is used on inaccessible members. &lt;/p&gt; &lt;p class="para"&gt;The &lt;var class="varname"&gt;$name&lt;/var&gt; argument is the name of the  member being interacted with. The &lt;i&gt;__set()&lt;/i&gt; method's &lt;var class="varname"&gt;$value&lt;/var&gt; argument specifies the value the &lt;var class="varname"&gt;$name&lt;/var&gt;'ed member should be set to. &lt;/p&gt; &lt;p class="para"&gt;Member overloading only works in object context. These magic  methods will not be triggered in static context. Therefore these methods can not  be declared &lt;a class="link" href="language.oop5.static.html"&gt;static&lt;/a&gt;. &lt;/p&gt; &lt;div class="example"&gt; &lt;p&gt;&lt;b&gt;Example #1 overloading with __get, __set, __isset and __unset  example&lt;/b&gt;&lt;/p&gt; &lt;div class="example-contents"&gt; &lt;div class="phpcode"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;class &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;MemberTest &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;{&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;/**  Location for overloaded data.  */&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;private &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$data &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= array();&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;/**  Overloading not used on declared members.  */&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;public &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$declared &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;/**  Overloading only used on this when accessed outside the class.  */&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;private &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$hidden &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;2&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;&lt;br /&gt;    public function &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;__set&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$name&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$value&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;) {&lt;br /&gt;        echo &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"Setting '&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$name&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;' to '&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$value&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'\n"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;data&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;[&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$name&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;] = &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$value&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public function &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;__get&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$name&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;) {&lt;br /&gt;        echo &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"Getting '&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$name&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'\n"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;        if (&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;array_key_exists&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$name&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;data&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;)) {&lt;br /&gt;            return &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;data&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;[&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$name&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;];&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$trace &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;debug_backtrace&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;();&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;trigger_error&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;br /&gt;            &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'Undefined property via __get(): ' &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;. &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$name &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;.&lt;br /&gt;            &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;' in ' &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;. &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$trace&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;[&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;0&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;][&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'file'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;] .&lt;br /&gt;            &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;' on line ' &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;. &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$trace&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;[&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;0&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;][&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'line'&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;],&lt;br /&gt;            &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;E_USER_NOTICE&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;        return &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;/**  As of PHP 5.1.0  */&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;public function &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;__isset&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$name&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;) {&lt;br /&gt;        echo &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"Is '&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$name&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;' set?\n"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;        return isset(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;data&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;[&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$name&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;]);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;/**  As of PHP 5.1.0  */&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;public function &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;__unset&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$name&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;) {&lt;br /&gt;        echo &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"Unsetting '&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$name&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;'\n"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;        unset(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;data&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;[&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$name&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;]);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;/**  Not a magic method, just here for example.  */&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;public function &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;getHidden&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;() {&lt;br /&gt;        return &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$this&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;hidden&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;echo &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"&lt;pre&gt;\n"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$obj &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= new &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;MemberTest&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$obj&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;a &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;= &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;echo &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$obj&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;a &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;. &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"\n\n"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;var_dump&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(isset(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$obj&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;a&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;));&lt;br /&gt;unset(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$obj&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;a&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;var_dump&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(isset(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$obj&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;a&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;));&lt;br /&gt;echo &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"\n"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;&lt;br /&gt;echo &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$obj&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;declared &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;. &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"\n\n"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;&lt;br /&gt;echo &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"Let's experiment with the private property named 'hidden':\n"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;echo &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"Privates are visible inside the class, so __get() not used...\n"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;echo &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$obj&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;getHidden&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;() . &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"\n"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;echo &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"Privates not visible outside of class, so __get() is used...\n"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;echo &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$obj&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;-&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;hidden &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;. &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"\n"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;?&gt;&lt;/span&gt; &lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/div&gt; &lt;div class="example-contents"&gt; &lt;p&gt;The above example will output:&lt;/p&gt;&lt;/div&gt; &lt;div class="example-contents"&gt;&lt;pre&gt;&lt;div class="cdata"&gt;&lt;pre&gt;Setting 'a' to '1'&lt;br /&gt;Getting 'a'&lt;br /&gt;1&lt;br /&gt;&lt;br /&gt;Is 'a' set?&lt;br /&gt;bool(true)&lt;br /&gt;Unsetting 'a'&lt;br /&gt;Is 'a' set?&lt;br /&gt;bool(false)&lt;br /&gt;&lt;br /&gt;1&lt;br /&gt;&lt;br /&gt;Let's experiment with the private property named 'hidden':&lt;br /&gt;Privates are visible inside the class, so __get() not used...&lt;br /&gt;2&lt;br /&gt;Privates not visible outside of class, so __get() is used...&lt;br /&gt;Getting 'hidden'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Notice:  Undefined property via __get(): hidden in &lt;file&gt; on line 70 in &lt;file&gt; on line 29&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;   &lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt; &lt;div class="sect2" id="language.oop5.overloading.methods"&gt; &lt;h3 class="title"&gt;Method overloading&lt;/h3&gt; &lt;div class="methodsynopsis dc-description"&gt;&lt;span class="type"&gt;&lt;a class="type mixed" href="language.pseudo-types.html#language.types.mixed"&gt;mixed&lt;/a&gt;&lt;/span&gt; &lt;span class="methodname"&gt;&lt;b&gt;&lt;b&gt;__call&lt;/b&gt;&lt;/b&gt;&lt;/span&gt; ( &lt;span class="methodparam"&gt;&lt;span class="type"&gt;string&lt;/span&gt; &lt;tt class="parameter"&gt;$name&lt;/tt&gt;&lt;/span&gt; , &lt;span class="methodparam"&gt;&lt;span class="type"&gt;array&lt;/span&gt; &lt;tt class="parameter"&gt;$arguments&lt;/tt&gt;&lt;/span&gt; )&lt;/div&gt; &lt;div class="methodsynopsis dc-description"&gt;&lt;span class="type"&gt;&lt;a class="type mixed" href="language.pseudo-types.html#language.types.mixed"&gt;mixed&lt;/a&gt;&lt;/span&gt; &lt;span class="methodname"&gt;&lt;b&gt;&lt;b&gt;__callStatic&lt;/b&gt;&lt;/b&gt;&lt;/span&gt; ( &lt;span class="methodparam"&gt;&lt;span class="type"&gt;string&lt;/span&gt; &lt;tt class="parameter"&gt;$name&lt;/tt&gt;&lt;/span&gt; , &lt;span class="methodparam"&gt;&lt;span class="type"&gt;array&lt;/span&gt; &lt;tt class="parameter"&gt;$arguments&lt;/tt&gt;&lt;/span&gt; )&lt;/div&gt; &lt;p class="para"&gt;&lt;i&gt;__call()&lt;/i&gt; is triggered when invoking inaccessible methods in  an object context. &lt;/p&gt; &lt;p class="para"&gt;&lt;i&gt;__callStatic()&lt;/i&gt; is triggered when invoking inaccessible  methods in a static context. &lt;/p&gt; &lt;p class="para"&gt;The &lt;var class="varname"&gt;$name&lt;/var&gt; argument is the name of the  method being called. The &lt;var class="varname"&gt;$arguments&lt;/var&gt; argument is an  enumerated array containing the parameters passed to the &lt;var class="varname"&gt;$name&lt;/var&gt;'ed method. &lt;/p&gt; &lt;div class="example"&gt; &lt;p&gt;&lt;b&gt;Example #2 overloading instantiated methods with __call and  ___callStatic&lt;/b&gt;&lt;/p&gt; &lt;div class="example-contents"&gt; &lt;div class="phpcode"&gt;&lt;code&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;&lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;class &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;MethodTest &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;{&lt;br /&gt;    public function &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;__call&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$name&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$arguments&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;) {&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;// Note: value of $name is case sensitive.&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;echo &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"Calling object method '&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$name&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;' "&lt;br /&gt;             &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;. &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;implode&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;', '&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$arguments&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;). &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"\n"&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;/**  As of PHP 5.3.0  */&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;public static function &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;__callStatic&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$name&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$arguments&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;) {&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;// Note: value of $name is case sensitive.&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;echo &lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;"Calling static method '&lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;$name&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;' "&lt;br /&gt;             &lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;. &lt;/span&gt;&lt;span style="color: rgb(0, 0, 187);"&gt;implode&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 0, 0);"&gt;', '&lt;/span&gt;&lt;span style="color: rgb(0, 119, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 
