<?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:blogger='http://schemas.google.com/blogger/2008' 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-1859388405414689578</id><updated>2024-11-06T08:31:01.574+05:30</updated><category term="PHP"/><category term="C"/><category term="C++"/><category term="Javascript"/><category term="Programmings"/><category term="MySQL"/><category term="JQuery"/><category term="Command Prompt"/><category term="HTML"/><category term="Mail"/><category term="Mobile"/><category term="Tool"/><category term="Browsers"/><category term="website"/><category term=".htaccess"/><category term="AJAX"/><category term="Data Card"/><category term="Database"/><category term="Facebook"/><category term="GPRS Settings"/><category term="Internet"/><category term="JSON"/><category term="MS Excel"/><category term="MySQL Trim() function"/><category term="MySQL Trim(BOTH) function"/><category term="MySQL Trim(LEADING) function"/><category term="MySQL Trim(trailing) function"/><category term="Query Commands"/><category term="String"/><category term="XAMPP"/><category term="check html tags"/><category term="get count php"/><category term="get count using php"/><category term="html tags"/><category term="html tags count"/><category term="html_entity_decode in jquery"/><category term="htmlentites in jquery"/><category term="http status code"/><category term="javascript html decode"/><category term="javascript html encode"/><category term="jquery html decode"/><category term="jquery html encode"/><category term="mobile website"/><category term="mysql both function"/><category term="mysql leading trim function"/><category term="mysql trailing function"/><category term="php card validation"/><category term="php credit card validation"/><category term="php img tag"/><category term="php mail validation"/><category term="php preg replace"/><category term="php redirect with http status code"/><category term="php tag"/><category term="preg_replace"/><category term="validate credit card"/><category term="wamp server"/><title type='text'>TechniqZone</title><subtitle type='html'>A Technical Guide for Developers.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default?start-index=26&amp;max-results=25'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>90</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-3927727260340894967</id><published>2014-08-26T19:55:00.001+05:30</published><updated>2014-08-26T19:55:27.130+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="php img tag"/><category scheme="http://www.blogger.com/atom/ns#" term="php preg replace"/><category scheme="http://www.blogger.com/atom/ns#" term="php tag"/><category scheme="http://www.blogger.com/atom/ns#" term="preg_replace"/><title type='text'>preg_replace to add something after closing tag - PHP</title><content type='html'>&lt;p&gt;&lt;img alt=&quot;preg_replace to add something after closing tag - PHP&quot; src=&quot;https://media.phpnuke.org/000/977/680/e52_6f1_580_580-4---phpnuke.jpg&quot; style=&quot;height:188px; width:250px&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style=&quot;font-size:14px&quot;&gt;&lt;span style=&quot;color:rgb(165, 42, 42)&quot;&gt;&lt;strong&gt;PHP - preg_replace to add something after closing tag :&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Here i will explain how to add something like string, char (or) any html tag after closing tag. Here we are using preg_replace() function to do it.&lt;/p&gt;

&lt;p&gt;In the below example, add &amp;lt;br /&amp;gt; tag after closing of all &amp;lt;img&amp;gt; tag.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntax :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color:#A52A2A&quot;&gt;&lt;strong&gt;preg_replace(&amp;#39;/(&amp;lt;img[^&amp;gt;]+&amp;gt;(?:&amp;lt;\/img&amp;gt;)?)/i&amp;#39;, &amp;#39;$1&amp;lt;br /&amp;gt;&amp;#39;, $str);&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;
Note : This will match with &amp;lt;img /&amp;gt;, &amp;lt;img&amp;gt;, &amp;lt;img&amp;gt;&amp;lt;/img&amp;gt; all of it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;&lt;span style=&quot;color:#A52A2A&quot;&gt;&amp;lt;?php&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $str = &amp;quot;&amp;lt;img src=&amp;#39;img_path&amp;#39;&amp;gt;TechniqZone&amp;lt;img src=&amp;#39;img_path&amp;#39;&amp;gt;&amp;quot;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo preg_replace(&amp;#39;/(&amp;lt;img[^&amp;gt;]+&amp;gt;(?:&amp;lt;\/img&amp;gt;)?)/i&amp;#39;, &amp;#39;$1&amp;lt;br /&amp;gt;&amp;#39;, $str);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; ?&amp;gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&lt;strong&gt;Output :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color:#A52A2A&quot;&gt;&lt;strong&gt;&amp;lt;img src=&amp;#39;img_path&amp;#39;&amp;gt;&amp;lt;br /&amp;gt;TechniqZone&amp;lt;img src=&amp;#39;img_path&amp;#39;&amp;gt;&amp;lt;br /&amp;gt;&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;
You can use this preg_replace() syntax for any of the html tags.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/3927727260340894967/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2014/08/pregreplace-to-add-something-after.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/3927727260340894967'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/3927727260340894967'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2014/08/pregreplace-to-add-something-after.html' title='preg_replace to add something after closing tag - PHP'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-4826248341808103365</id><published>2014-08-14T19:24:00.001+05:30</published><updated>2014-08-18T11:01:14.317+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="html_entity_decode in jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="htmlentites in jquery"/><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript html decode"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript html encode"/><category scheme="http://www.blogger.com/atom/ns#" term="JQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery html decode"/><category scheme="http://www.blogger.com/atom/ns#" term="jquery html encode"/><title type='text'>htmlentities() and html_entity_decode() in JQuery</title><content type='html'>&lt;span style=&quot;color: brown; font-size: small;&quot;&gt;&lt;i&gt;&lt;b&gt;htmlentities() and html_entity_decode() in JQuery :&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;img alt=&quot;htmlentities() and html_entity_decode() in JQuery&quot; src=&quot;http://codesignature.com/wp-content/uploads/2012/05/post4.png&quot; style=&quot;height: 300px; width: 300px;&quot; /&gt;&lt;br /&gt;
We are all know about use of htmlentities() in PHP. This function is used to convert all character to HTML entities. both function are used to treat string as a html and HTML as a string.&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;For Example :&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: brown;&quot;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo htmlentities(&quot;&lt;a href=&quot;http://techniqzone.blogspot.in/&quot;&gt;TechniqZone&lt;/a&gt;&quot;);&lt;br /&gt;
&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;gt;&lt;/span&gt;&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;&amp;nbsp; &lt;b&gt;Output :&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;lt ;a href=&amp;amp;#39 ;techniqzone.blogspot.in&#39;&amp;amp;#39 ;&amp;amp;gt ;TechniqZone&amp;amp;lt ;/a&amp;amp;gt ;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;// here semicolons (;) are placed with spaces for display here.&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; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This is very usefull in many places in php files to display html tags in website. But in javascript/JQuery, pre-defined encode decode function is not available.&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;&amp;nbsp; I hereby explained how to use encode and decode of HTML tags in JQuery. Before that need to know the diifference between JQuery.html() and JQuery.text().&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: brown;&quot;&gt;JQuery.html() - Treat string as HTML.&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; JQuery.html() - Treat HTML as string.&lt;/span&gt;&lt;br /&gt;
&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;&lt;b&gt; For Example :&lt;/b&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: brown;&quot;&gt; $(&quot;#techZone&quot;).html(&quot;&amp;lt;a href=&#39;&#39;&amp;gt;&amp;lt;/a&amp;gt;&quot;);&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; $(&quot;#techZone&quot;).text(&quot;&amp;lt;a href=&#39;&#39;&amp;gt;&amp;lt;/a&amp;gt;&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Okay, now we create encode/decode custom function using JQuery.&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: brown;&quot;&gt;function htmlentities(str)&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;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(str) // check str is empty or not.&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;return $(&quot;&amp;lt;div /&amp;gt;&quot;).text(str).html();&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;return &#39;Argument mis-matched&#39;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;&lt;span style=&quot;color: brown;&quot;&gt;&amp;nbsp;htmlentities(&quot;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: brown;&quot;&gt;&lt;span style=&quot;color: brown;&quot;&gt;&lt;a href=&quot;http://techniqzone.blogspot.in/&quot;&gt;TechniqZone&lt;/a&gt;&lt;/span&gt;&quot;);&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; Here create dummy &amp;lt;div&amp;gt; tag and append given string as text, after that take that dummy div text as html content.&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;b&gt;For decode,&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: brown;&quot;&gt;function html_entity_decode(str)&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;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(str) // check str is empty or not.&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;return $(&quot;&amp;lt;div /&amp;gt;&quot;).html(str).text();&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;return &#39;Argument mis-matched&#39;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: brown;&quot;&gt;html_entity_decode(&quot;&amp;amp;lt ;a href=&amp;amp;#39 ;techniqzone.blogspot.in&amp;amp;#39 ;&amp;amp;gt ;TechniqZone&amp;amp;lt ;/a&amp;amp;gt ;&quot;);&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
// here semicolons (;) are placed with spaces for display here.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Note : &lt;/b&gt;htmlentities and html_entity_decode function are only working with jquery plugin files.</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/4826248341808103365/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2014/08/htmlentities-and-htmlentitydecode-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/4826248341808103365'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/4826248341808103365'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2014/08/htmlentities-and-htmlentitydecode-in.html' title='htmlentities() and html_entity_decode() in JQuery'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-722677731042899554</id><published>2014-06-06T19:01:00.001+05:30</published><updated>2014-06-06T19:01:26.883+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="http status code"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="php redirect with http status code"/><title type='text'>Redirect with HTTP Status Code - PHP</title><content type='html'>&lt;p&gt;&lt;em&gt;&lt;strong&gt;Redirect with HTTP Status Code - PHP :&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;img alt=&quot;Redirect with HTTP Status Code - PHP - TechniqZone&quot; src=&quot;http://www.prosoxi.com/wp-content/uploads/2011/04/cdl_capture_2011-04-17-17_-000.jpg&quot; style=&quot;height:144px; width:206px&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;Redirect one url to another url using php is simply run with &amp;quot;header (&amp;quot;Location: redirectURL&amp;quot;);&amp;quot; . But redirect with HTTP Status Code is more efficient to optimize for search engines.&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Here i will explain about php redirect with http status code. These http status code is common for all php versions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;color:#008080&quot;&gt;&amp;lt;?php&lt;br /&gt;
function httpRedirect($code,$redirectURL){&lt;br /&gt;
&amp;nbsp;&amp;nbsp; static $httpType = array (&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100 =&amp;gt; &amp;quot;HTTP/1.1 100 Continue&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 101 =&amp;gt; &amp;quot;HTTP/1.1 101 Switching Protocols&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 200 =&amp;gt; &amp;quot;HTTP/1.1 200 OK&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 201 =&amp;gt; &amp;quot;HTTP/1.1 201 Created&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 202 =&amp;gt; &amp;quot;HTTP/1.1 202 Accepted&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 203 =&amp;gt; &amp;quot;HTTP/1.1 203 Non-Authoritative Information&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 204 =&amp;gt; &amp;quot;HTTP/1.1 204 No Content&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 205 =&amp;gt; &amp;quot;HTTP/1.1 205 Reset Content&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 206 =&amp;gt; &amp;quot;HTTP/1.1 206 Partial Content&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 300 =&amp;gt; &amp;quot;HTTP/1.1 300 Multiple Choices&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 301 =&amp;gt; &amp;quot;HTTP/1.1 301 Moved Permanently&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 302 =&amp;gt; &amp;quot;HTTP/1.1 302 Found&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 303 =&amp;gt; &amp;quot;HTTP/1.1 303 See Other&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 304 =&amp;gt; &amp;quot;HTTP/1.1 304 Not Modified&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 305 =&amp;gt; &amp;quot;HTTP/1.1 305 Use Proxy&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 307 =&amp;gt; &amp;quot;HTTP/1.1 307 Temporary Redirect&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 400 =&amp;gt; &amp;quot;HTTP/1.1 400 Bad Request&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 401 =&amp;gt; &amp;quot;HTTP/1.1 401 Unauthorized&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 402 =&amp;gt; &amp;quot;HTTP/1.1 402 Payment Required&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 403 =&amp;gt; &amp;quot;HTTP/1.1 403 Forbidden&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 404 =&amp;gt; &amp;quot;HTTP/1.1 404 Not Found&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 405 =&amp;gt; &amp;quot;HTTP/1.1 405 Method Not Allowed&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 406 =&amp;gt; &amp;quot;HTTP/1.1 406 Not Acceptable&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 407 =&amp;gt; &amp;quot;HTTP/1.1 407 Proxy Authentication Required&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 408 =&amp;gt; &amp;quot;HTTP/1.1 408 Request Time-out&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 409 =&amp;gt; &amp;quot;HTTP/1.1 409 Conflict&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 410 =&amp;gt; &amp;quot;HTTP/1.1 410 Gone&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 411 =&amp;gt; &amp;quot;HTTP/1.1 411 Length Required&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 412 =&amp;gt; &amp;quot;HTTP/1.1 412 Precondition Failed&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 413 =&amp;gt; &amp;quot;HTTP/1.1 413 Request Entity Too Large&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 414 =&amp;gt; &amp;quot;HTTP/1.1 414 Request-URI Too Large&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 415 =&amp;gt; &amp;quot;HTTP/1.1 415 Unsupported Media Type&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 416 =&amp;gt; &amp;quot;HTTP/1.1 416 Requested range not satisfiable&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 417 =&amp;gt; &amp;quot;HTTP/1.1 417 Expectation Failed&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 500 =&amp;gt; &amp;quot;HTTP/1.1 500 Internal Server Error&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 501 =&amp;gt; &amp;quot;HTTP/1.1 501 Not Implemented&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 502 =&amp;gt; &amp;quot;HTTP/1.1 502 Bad Gateway&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 503 =&amp;gt; &amp;quot;HTTP/1.1 503 Service Unavailable&amp;quot;,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 504 =&amp;gt; &amp;quot;HTTP/1.1 504 Gateway Time-out&amp;quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; );&lt;br /&gt;
&amp;nbsp;&amp;nbsp; header($httpType[$code]);&lt;br /&gt;
&amp;nbsp;&amp;nbsp; header (&amp;quot;Location: $redirectURL&amp;quot;);&lt;br /&gt;
}&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;color:#008080&quot;&gt;httpRedirect(301,&amp;quot;http://techniqzone.blogspot.in/&amp;quot;);&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;color:#008080&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Normally we do only header(&amp;quot;Location: url&amp;quot;), here add header http status before redirect to given url.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/722677731042899554/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2014/06/redirect-with-http-status-code-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/722677731042899554'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/722677731042899554'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2014/06/redirect-with-http-status-code-php.html' title='Redirect with HTTP Status Code - PHP'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-6609803408303788853</id><published>2014-06-05T17:22:00.001+05:30</published><updated>2014-06-05T17:22:12.340+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="php card validation"/><category scheme="http://www.blogger.com/atom/ns#" term="php credit card validation"/><category scheme="http://www.blogger.com/atom/ns#" term="validate credit card"/><title type='text'>PHP Validate Credit Card Number</title><content type='html'>&lt;p&gt;&lt;em&gt;&lt;strong&gt;PHP Validate Credit Card Number :&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;img alt=&quot;PHP Validate Credit Card - TechniqZone&quot; src=&quot;http://www.thehiddenwiki.net/wp-content/uploads/2013/08/credit-cards_2007247b.jpg&quot; style=&quot;height:167px; width:267px&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;Now a days , credit card purchase is happened in many websites. The below php function is used to validate the given credit card number in php.&lt;/p&gt;

&lt;p&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;function&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#0000bb; font-family:monospace&quot;&gt;isCreditCardValid&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;(&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#0000bb; font-family:monospace&quot;&gt;$number&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#0000bb; font-family:monospace&quot;&gt;$cctype&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;)&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;(&amp;nbsp;!&lt;/span&gt;&lt;span style=&quot;color:#0000bb; font-family:monospace&quot;&gt;is_string&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;(&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#0000bb; font-family:monospace&quot;&gt;$number&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;||&amp;nbsp;!&lt;/span&gt;&lt;span style=&quot;color:#0000bb; font-family:monospace&quot;&gt;trim&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;(&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#0000bb; font-family:monospace&quot;&gt;$number&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;)&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;&amp;nbsp;return&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#0000bb; font-family:monospace&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;;&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;&lt;/span&gt;&lt;span style=&quot;color:#0000bb; font-family:monospace&quot;&gt;$ccs&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;=&amp;nbsp;array&amp;nbsp;(&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;//&amp;nbsp;Master&amp;nbsp;Card&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#dd0000; font-family:monospace&quot;&gt;&amp;#39;master&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#dd0000; font-family:monospace&quot;&gt;&amp;#39;/^(5[1-5]{1})(\d{14})$/&amp;#39;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;,&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family:monospace&quot;&gt;&lt;span style=&quot;color:#ff8000&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;//&amp;nbsp;American&amp;nbsp;Express&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#dd0000; font-family:monospace&quot;&gt;&amp;#39;amex&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#dd0000; font-family:monospace&quot;&gt;&amp;#39;/^3(4|7)\d{13}$/&amp;#39;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;//&amp;nbsp;Discover&amp;nbsp;Card&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#dd0000; font-family:monospace&quot;&gt;&amp;#39;discover&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#dd0000; font-family:monospace&quot;&gt;&amp;#39;/^6(011|22|4|5)(\d{12}|\d{13}|\d{14})$/&amp;#39;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;//&amp;nbsp;Visa&amp;nbsp;Card&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#dd0000; font-family:monospace&quot;&gt;&amp;#39;visa&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#dd0000; font-family:monospace&quot;&gt;&amp;#39;/^4(\d{12}|\d{15})$/&amp;#39;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;,&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family:monospace&quot;&gt;&lt;span style=&quot;color:#ff8000&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;//&amp;nbsp;Dinners&amp;nbsp;Club&lt;/span&gt;&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#dd0000; font-family:monospace&quot;&gt;&amp;#39;dinners&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#dd0000; font-family:monospace&quot;&gt;&amp;#39;/^(305|36|38|54|55)(\d{12}|\d{14})$/&amp;#39;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;,&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp;Carte&amp;nbsp;Blanche&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#dd0000; font-family:monospace&quot;&gt;&amp;#39;carte&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#dd0000; font-family:monospace&quot;&gt;&amp;#39;/^(30[0-5]{1})(\d{11})$/&amp;#39;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;//&amp;nbsp;enRoute&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#dd0000; font-family:monospace&quot;&gt;&amp;#39;enroute&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#dd0000; font-family:monospace&quot;&gt;&amp;#39;/^2(014|149)\d{11}$/&amp;#39;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;//&amp;nbsp;Laser&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#dd0000; font-family:monospace&quot;&gt;&amp;#39;laser&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#dd0000; font-family:monospace&quot;&gt;&amp;#39;/^6(304|706|771|709)(\d{12}|\d{13}|\d{14}&amp;#39;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#dd0000; font-family:monospace&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;#39;|d{\15})$/&amp;#39;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family:monospace&quot;&gt;&lt;span style=&quot;color:#ff8000&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;//&amp;nbsp;Visa&amp;nbsp;Electron&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#dd0000; font-family:monospace&quot;&gt;&amp;#39;visaelec&amp;#39;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#dd0000; font-family:monospace&quot;&gt;&amp;#39;/^4(17500|917|913|844|508)(\d{10}|\d{12})$/&amp;#39;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;,&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color:#ff8000; font-family:monospace&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;(&amp;nbsp;!&lt;/span&gt;&lt;span style=&quot;color:#0000bb; font-family:monospace&quot;&gt;is_string&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;(&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#0000bb; font-family:monospace&quot;&gt;$cctype&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;||&amp;nbsp;!&lt;/span&gt;&lt;span style=&quot;color:#0000bb; font-family:monospace&quot;&gt;array_key_exists&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;(&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#0000bb; font-family:monospace&quot;&gt;strtolower&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color:#0000bb; font-family:monospace&quot;&gt;$cctype&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;)&amp;nbsp;,&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#0000bb; font-family:monospace&quot;&gt;$ccs&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;)&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;&amp;nbsp;return&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#0000bb; font-family:monospace&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;(bool)&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#0000bb; font-family:monospace&quot;&gt;preg_match&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;(&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#0000bb; font-family:monospace&quot;&gt;$ccs&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color:#0000bb; font-family:monospace&quot;&gt;$cctype&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;],&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#0000bb; font-family:monospace&quot;&gt;$number&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:#007700; font-family:monospace&quot;&gt;);&lt;br /&gt;
}&amp;nbsp;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;Example :&lt;/p&gt;

&lt;p&gt;&amp;lt;?php&lt;/p&gt;

&lt;p&gt;if(isCreditCardValid(&amp;quot;371449635398431&amp;quot;,&amp;quot;amex&amp;quot;))&lt;br /&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; echo &amp;quot;Valid&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
else&lt;br /&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; echo &amp;quot;Not Valid&amp;quot;;&lt;br /&gt;
}&lt;/p&gt;

&lt;p&gt;?&amp;gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;Here preg_match concept is used to identify the valid credit card number.&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/6609803408303788853/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2014/06/php-validate-credit-card-number.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/6609803408303788853'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/6609803408303788853'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2014/06/php-validate-credit-card-number.html' title='PHP Validate Credit Card Number'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-4795729159174390940</id><published>2014-05-21T18:51:00.001+05:30</published><updated>2014-06-07T14:05:07.935+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql both function"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql leading trim function"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql trailing function"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL Trim() function"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL Trim(BOTH) function"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL Trim(LEADING) function"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL Trim(trailing) function"/><title type='text'>MySQL query to trim particular character from database column field</title><content type='html'>MySQL has some default functions to trim particular cahr or whitespaces from all the column field in database rows. MySQL provide four type of methods to trim char.&lt;br /&gt;
&lt;b&gt;1. TRIM()&lt;br /&gt;
2. TRIM(LEADING)&lt;br /&gt;
3. TRIM(BOTH)&lt;br /&gt;
4. TRIM(TRAILING)&lt;/b&gt;&lt;br /&gt;
we can use above four methods in select, update and delete queries.&lt;br /&gt;
&lt;b&gt;1. TRIM()&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;TRIM() function is used to remove the whitespaces from start and end of the string.&lt;br /&gt;
&lt;i&gt;Query : select TRIM( TechniqZone );&lt;br /&gt;
Result : TechniqZone&lt;/i&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;This is trim the whitespaces in all the column.&lt;br /&gt;
&lt;i&gt;Example : update table_name set field1=TRIM(field1)&lt;/i&gt;&lt;br /&gt;
&lt;b&gt;2. TRIM(LEADING)&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;TRIM(LEADING) function is used to remove the given charecter from the starting postion of the string.&lt;br /&gt;
&lt;i&gt;Query : select TRIM(LEADING &quot;&#39;&quot; FROM &quot;TechniqZone&#39;&quot;);&lt;br /&gt;
Rssult : TechniqZone&lt;/i&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;This method is remove the single quotes(&#39;) from al the column starting postion.&lt;br /&gt;
&lt;i&gt;Example : update table_name set field1=TRIM(LEADING &quot;&#39;&quot; FROM field1)&lt;/i&gt;&lt;br /&gt;
&lt;b&gt;3. TRIM(BOTH)&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;TRIM(BOTH) function is used to remove particular charecter from both start and end postion of the string.&lt;br /&gt;
&lt;i&gt;Query : select TRIM(BOTH &#39;&quot;&#39; FROM &#39;&quot;TechniqZone&quot;&#39;);&lt;br /&gt;
Rssult : TechniqZone&lt;/i&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;This is used to remove the double quotes (&quot;) from both position.&lt;br /&gt;
&lt;i&gt;Example : update table_name set field1=TRIM(BOTH &quot;&#39;&quot; FROM field1)&lt;/i&gt;&lt;br /&gt;
&lt;b&gt;4. TRIM(TRAILING)&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;TRIM(TRAILING) function is used to remove given charecter from end of the string.&lt;br /&gt;
&lt;i&gt;Query : select TRIM(TRAILING &#39;.com&#39; FROM &quot;TechniqZone.com&quot;);&lt;br /&gt;
Rssult : TechniqZone&lt;/i&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;This MySQL query remove the .com from the end of the string.&lt;br /&gt;
&lt;i&gt;Example : update table_name set field1=TRIM(TRAILING &quot;xxx&quot; FROM field1)&lt;/i&gt;&lt;br /&gt;
Note : TRIM() and TRIM(BOTH) is same as when we remove whitesapces from database column.&lt;br /&gt;
&lt;img alt=&quot;MySQL query to trim particular charecter from database column field - TechniqZone&quot; src=&quot;http://instaminds.com/wp-content/uploads/2013/06/phpmysql.jpg&quot; style=&quot;height: 225px; width: 333px;&quot; /&gt;</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/4795729159174390940/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2014/05/mysql-query-to-trim-particular.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/4795729159174390940'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/4795729159174390940'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2014/05/mysql-query-to-trim-particular.html' title='MySQL query to trim particular character from database column field'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-3654905238840250553</id><published>2014-05-20T14:49:00.001+05:30</published><updated>2014-05-20T15:00:09.847+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="check html tags"/><category scheme="http://www.blogger.com/atom/ns#" term="get count php"/><category scheme="http://www.blogger.com/atom/ns#" term="get count using php"/><category scheme="http://www.blogger.com/atom/ns#" term="html tags"/><category scheme="http://www.blogger.com/atom/ns#" term="html tags count"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>Check String contains html tags and count of html tags using PHP</title><content type='html'>&lt;img alt=&quot;Check String contains html tags and count of html tags using PHP&quot; src=&quot;http://api.ning.com/files/0OLa1CvpziEH6f3l5zppT3bQGRQ-XhNB6HA6X9q6JATGrOclE*hrfcNCgZAR51icfSqFau1IOZeFvw9RzSyFH*-GOso2G8IG/html.png&quot; style=&quot;height: 261px; width: 467px;&quot; /&gt;&lt;br /&gt;
Here i will explain how to check the given string contains html tags or not.&amp;nbsp; this function return boolean value.&lt;br /&gt;
&lt;code&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #ff8000;&quot;&gt;//&amp;nbsp;Function for check html tag presents&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;hasTags&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;){&lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;$htmlTags &lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;=&amp;nbsp;array(&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;A&#39; &lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;B&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;BODY&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt; &#39;BR&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt; &#39;BUTTON&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;DIV&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;FONT&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;H1&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;H2&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;H3&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;H4&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;H5&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;H6&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt; &#39;IMG&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;INPUT&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &#39;&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;TABLE&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&#39;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #ff8000;&quot;&gt;// Here you mention what are the html tags you want to check&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;span style=&quot;color: #007700;&quot;&gt;if(&lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;preg_match_all&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&quot;~(&amp;lt;\/?)\b(&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;implode&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;|&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;$htmlTags&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;).&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&quot;)\b([^&amp;gt;]*&amp;gt;)~i&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;$matches&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;)){&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;return&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;;&lt;br /&gt;
&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;return&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;FALSE&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
} &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;$str&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;Welcome to &amp;lt;h1&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/h1&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;; &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;if(hasTags&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;)){&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;HTML tags Found&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;;&lt;br /&gt;
}else{&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;HTML tags not found&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;;&lt;br /&gt;
}&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
If you want to get the present html tags count then consider the below function.&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #ff8000;&quot;&gt;//&amp;nbsp;Function for check html tag presents&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;function &lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;hasTags&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;){&lt;br /&gt;&amp;nbsp;$htmlTags &lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;=&amp;nbsp;array(&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;A&#39; &lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;B&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;BODY&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt; &#39;BR&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt; &#39;BUTTON&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;DIV&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;FONT&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;H1&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;H2&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;H3&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;H4&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;H5&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;H6&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt; &#39;IMG&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;INPUT&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;, &#39;&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;TABLE&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&#39;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #007700;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #ff8000;&quot;&gt;// Here you mention what are the html tags you want to check&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #007700;&quot;&gt;if(&lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;preg_match_all&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&quot;~(&amp;lt;\/?)\b(&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;implode&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;|&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;$htmlTags&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;).&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&quot;)\b([^&amp;gt;]*&amp;gt;)~i&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;$matches&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;)){&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;$matches[1]&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;;&lt;br /&gt;
&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;return &lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;
} &lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;$str&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;=&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;Welcome to &amp;lt;h1&amp;gt;&amp;lt;b&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/h1&amp;gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;; &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #007700;&quot;&gt;echo&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #dd0000;&quot;&gt;&#39;Tags Count = &#39;.&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;hasTags&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000bb;&quot;&gt;$str&lt;/span&gt;&lt;span style=&quot;color: #007700;&quot;&gt;);&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/3654905238840250553/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2014/05/check-string-contains-html-tags-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/3654905238840250553'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/3654905238840250553'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2014/05/check-string-contains-html-tags-and.html' title='Check String contains html tags and count of html tags using PHP'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-5379828164543389517</id><published>2013-08-25T12:31:00.001+05:30</published><updated>2013-10-28T18:50:07.585+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="JQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="Mail"/><title type='text'>Email validation using JavaScript and Jquery</title><content type='html'>&lt;span style=&quot;color: #351c75; font-size: large;&quot;&gt;&lt;b&gt;Email validation using JavaScript and Jquery&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: #351c75; font-size: large;&quot;&gt;&amp;nbsp;:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOmYJrwkpuhVTEqLs-kGIwbdl6OST07ZPAUqj30tQdeYDpBJgxUfeC3Ekk_-Q7eKFjkwSAOBHd1qDYou9hmi7hW0m2D-ISpRnHYvEJgxzEBH06XE_Yo3dLQDgnR-U96NiMNSoUqEzDiAk/s1600/687474703a2f2f6576656e74732e6a71756572792e6f72672f323031322f646576656c6f7065722d73756d6d69742f6173736574732f696d616765732f73756d6d69745f6c6f676f2e706e67.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Email validation in Jquery - TechniqZone&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOmYJrwkpuhVTEqLs-kGIwbdl6OST07ZPAUqj30tQdeYDpBJgxUfeC3Ekk_-Q7eKFjkwSAOBHd1qDYou9hmi7hW0m2D-ISpRnHYvEJgxzEBH06XE_Yo3dLQDgnR-U96NiMNSoUqEzDiAk/s320/687474703a2f2f6576656e74732e6a71756572792e6f72672f323031322f646576656c6f7065722d73756d6d69742f6173736574732f696d616765732f73756d6d69745f6c6f676f2e706e67.png&quot; height=&quot;177&quot; title=&quot;Email validation in Jquery - TechniqZone&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&amp;nbsp;Here i will explain how to validate email id with JQuery. In JavaScript we can check the email id format only. but in jquery we can check whether we allow or not some of domain names also. First i will explain basic javascript method to validate email id.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;Here is Javascript method :&lt;/b&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;&lt;pre class=&quot;brush:javascript&quot;&gt;
function validateEmail(emailId)
{
var condition = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
return condition.test(emailId);
}
&lt;/pre&gt;
In this javascript method only validate the given email id has alphabets and numeric. Here the variable &quot;condition&quot; has the email conditions. that is&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;([a-zA-Z0-9_.+-])&lt;/b&gt; - is to allow email id username with &amp;nbsp;alphabets and numeric and also _.&lt;br /&gt;
&lt;b&gt;@(([a-zA-Z0-9-])&lt;/b&gt; - is to allow domail name with alphabets and numeric . and&lt;br /&gt;
&lt;b&gt;([a-zA-Z0-9]{2,4})&lt;/b&gt; - is to allow last part of the email id i.e., com, in, .. with alphabets and numeric and also &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; it&#39;s length should be 2 to 4.&lt;br /&gt;
&lt;br /&gt;
Now i will explain how to validate email id with JQuery.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Here is JQuery Method :&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush:javascript&quot;&gt;
$(document).ready(function() {

  $(&#39;#submitButton&#39;).click(function() {

    var emailCon = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
    var emailblockCon =/^([\w-\.]+@(?!gmail.com)(?!yahoo.com)([\w-]+\.)+[\w-]{2,4})?$/;

    var emailId = $(&quot;#mailId&quot;).val();
    if(emailId == &#39;&#39;) {
      $(&quot;#mailId&quot;).val(&#39;Email id is Blank.&#39;);
      error = true
    }

    else if(!emailCon.test(emailId)) {
      $(&quot;#mailId&quot;).val(&#39;Check Your Email id.&#39;);
      error = true
    }

    else if(!emailblockCon.test(emailId)) {
      $(&quot;#mailId&quot;).val(&#39;gmail and yahoo mail ids not accept.&#39;);
      error = true
    }

    if(error == true) {
           return false;
    }

    });
}); &lt;/pre&gt;
&lt;br /&gt;
In this JQuery method you can check the email format like in javascript . In jquery we validate extra one condition. here we validate the email id domain name also. because some of the website doesnt allow some free email providers domain. so we can also validate it here.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/5379828164543389517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2013/08/email-validation-using-javascript-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/5379828164543389517'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/5379828164543389517'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2013/08/email-validation-using-javascript-and.html' title='Email validation using JavaScript and Jquery'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOmYJrwkpuhVTEqLs-kGIwbdl6OST07ZPAUqj30tQdeYDpBJgxUfeC3Ekk_-Q7eKFjkwSAOBHd1qDYou9hmi7hW0m2D-ISpRnHYvEJgxzEBH06XE_Yo3dLQDgnR-U96NiMNSoUqEzDiAk/s72-c/687474703a2f2f6576656e74732e6a71756572792e6f72672f323031322f646576656c6f7065722d73756d6d69742f6173736574732f696d616765732f73756d6d69745f6c6f676f2e706e67.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-4503744369342072082</id><published>2013-08-19T17:40:00.001+05:30</published><updated>2013-08-24T16:31:53.872+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><category scheme="http://www.blogger.com/atom/ns#" term="php mail validation"/><title type='text'>PHP - Validate Email Id</title><content type='html'>&lt;div class=&quot;mobile-photo&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcV35RtvrfWBI64ZdAW6f0zx4v3d2KQX2J5MPIcj7QJiuI5ITthyqFihu_39-Rtew8sGQMi4Jsjaaa_f1APfpQCPJryliuuxZ37SGrMbaa1BbKHtgB_XhMUL42ghQ6GmpRH5sHPjb9kK4/s1600/email-validation-706418.jpg&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5913801486563635154&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcV35RtvrfWBI64ZdAW6f0zx4v3d2KQX2J5MPIcj7QJiuI5ITthyqFihu_39-Rtew8sGQMi4Jsjaaa_f1APfpQCPJryliuuxZ37SGrMbaa1BbKHtgB_XhMUL42ghQ6GmpRH5sHPjb9kK4/s320/email-validation-706418.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;b&gt; PHP - Validate Email Id :&lt;/b&gt; &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Here i will explain how to validate email id in php. This is very use full to validate email id in server side. php is used in server so we can validate email id in server side. if you want to validate email id in client side then you can use JavaScript, jquery etc...&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;The below example will show you how to validate email id in PHP &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt; Example :&lt;br /&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;$mailId = &quot;&lt;a href=&quot;mailto:xxx@gmail.com&quot;&gt;xxx@gmail.com&lt;/a&gt;&quot;; // Valid email&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;$conditions = &#39;/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([comco.in])+$/&#39;;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;if (preg_match($conditions, $mailId))&lt;br /&gt;{&lt;br /&gt;echo &quot;Valid Mail Id&quot;;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;echo &quot;Invalid Mail Id&quot;;&lt;br /&gt;}&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;?&amp;amp;gt&lt;/span&gt;;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;In the above example &quot;$mailId&quot; having the email id given by user. and &quot;$conditions&quot; having conditions for validate given email id. here i used &quot;preg_match()&quot; predefined php function. this function return boolean value. if the match occurred then it will return true otherwise false.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;The above example print &quot;Valid Mail Id&quot;. Here the variable &quot;$conditions&quot; have &quot;com&quot;,&quot;co&quot;,&quot;in&quot; conditions only, so it will allow these extension mail id only. and it will validate all allowed special characters only.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;if A&lt;b&gt;$mailId=&quot;xxx@gmailo.comnm&quot;&lt;/b&gt; then the output is &quot;Invalid Mail Id&quot;.</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/4503744369342072082/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2013/08/php-validate-email-id.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/4503744369342072082'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/4503744369342072082'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2013/08/php-validate-email-id.html' title='PHP - Validate Email Id'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcV35RtvrfWBI64ZdAW6f0zx4v3d2KQX2J5MPIcj7QJiuI5ITthyqFihu_39-Rtew8sGQMi4Jsjaaa_f1APfpQCPJryliuuxZ37SGrMbaa1BbKHtgB_XhMUL42ghQ6GmpRH5sHPjb9kK4/s72-c/email-validation-706418.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-7254117090628962692</id><published>2013-08-14T12:31:00.001+05:30</published><updated>2013-08-17T11:02:58.948+05:30</updated><title type='text'>Create directory with current year and month name - php</title><content type='html'>&lt;div class=&quot;mobile-photo&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;mobile-photo&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;Create directory with current &lt;span style=&quot;font-size: large;&quot;&gt;y&lt;/span&gt;ear and &lt;span style=&quot;font-size: large;&quot;&gt;m&lt;/span&gt;onth name - php :&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;mobile-photo&quot;&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5911866618733117378&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpxsuwr6QFyhyphenhyphenzDhGn2wNHl2xqWxKnmj-mrVohleL7sDZm_wi7HumEqTUlpNShkZWDF8qfdtQT6Bb_l7LGh43_ucAg1c9tRvm_uKfkcMnptpocO_KEviOZP5qytWngEQxdiTE-uGfQcRo/s320/create-folder-709912.png&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: black; font-family: times new roman, new york, times, serif; font-size: 12pt;&quot;&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; color: black; font-family: times new roman,new york,times,serif; font-size: 16px; font-style: normal;&quot;&gt;
&amp;nbsp; Here i will explain about how to create folder / directory with the current year and month name. It is very usefull to seperate the uploaded image or file with the particular year and month name.&lt;br /&gt;&lt;br /&gt;  Here we will use the simple concept to create this. here date() function is used to get current year and month details. &lt;br /&gt;&lt;br /&gt;
For Example : &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt; if (!file_exists(&quot;techniq/&quot;.date(&#39;Y&#39;).&#39;/&#39;.date(&#39;m&#39;))) {&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mkdir(&quot;techniq/&quot;.date(&#39;Y&#39;).&#39;/&#39;.date(&#39;m&#39;), 0777, true);&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; }&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; In the above example three php pre defined function are   used. that is file_exists() , date() , mkdir().&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. file_exists() :- This function is used to check the given path for directory is available or not. It will return bool value. If the file exists then it will return TRUE otherwise FALSE.&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;2. date() :- This function is used to get current timestamp. here i used date(&#39;Y&#39;), it will return current year in numeric i.e., 2013. and date(&#39;m&#39;) return current month in the format of 08.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; Note : Read more about date() : http://techniqzone.blogspot.in/2013/07/php-to-get-yesterdayprevious-date.html&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3. mkdir() :- This function is used to create a directory with the give filename or path. here i used 0777 argument for set folder permission for the created directory.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
This method is easy to create Folder(directory) with current Year and Month name in php.&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/7254117090628962692/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2013/08/create-folderdirectory-with-current.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/7254117090628962692'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/7254117090628962692'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2013/08/create-folderdirectory-with-current.html' title='Create directory with current year and month name - php'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjpxsuwr6QFyhyphenhyphenzDhGn2wNHl2xqWxKnmj-mrVohleL7sDZm_wi7HumEqTUlpNShkZWDF8qfdtQT6Bb_l7LGh43_ucAg1c9tRvm_uKfkcMnptpocO_KEviOZP5qytWngEQxdiTE-uGfQcRo/s72-c/create-folder-709912.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-8161749931743098255</id><published>2013-08-13T16:45:00.000+05:30</published><updated>2013-08-17T11:03:49.050+05:30</updated><title type='text'>Export particular column data from table in phpmyadmin</title><content type='html'>&lt;div class=&quot;mobile-photo&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzidjj0P8eFWM4aOdJZkkZQRot385kA9Q6SEekFavg56XQc3d-Atwp6NRV3K-Gkqp0BTO01rbGGj2KEmsFqwVPwoUaiWFytdrByIZq3YLb1YnNm9uNV7QbEQ6GS47c9PP3ErOguI6HBb4/s1600/phpMyAdmin-Logo-798880.png&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5911561198661402066&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzidjj0P8eFWM4aOdJZkkZQRot385kA9Q6SEekFavg56XQc3d-Atwp6NRV3K-Gkqp0BTO01rbGGj2KEmsFqwVPwoUaiWFytdrByIZq3YLb1YnNm9uNV7QbEQ6GS47c9PP3ErOguI6HBb4/s320/phpMyAdmin-Logo-798880.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: white; color: black; font-family: times new roman, new york, times, serif; font-size: 12pt;&quot;&gt;
&lt;div style=&quot;font-family: times new roman, new york, times, serif; font-size: 12pt;&quot;&gt;
&lt;div style=&quot;font-family: times new roman, new york, times, serif; font-size: 12pt;&quot;&gt;
&lt;br /&gt;
&lt;div class=&quot;y_msg_container&quot;&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;Export particular column data from table in phpmyadmin :&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div id=&quot;yiv2756446660&quot;&gt;
&lt;div&gt;
&lt;div style=&quot;background-color: white; color: black; font-family: times new roman, new york, times, serif; font-size: 12pt;&quot;&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;background-color: transparent; color: black; font-family: times new roman, new york, times, serif; font-size: 16px; font-style: normal;&quot;&gt;
&amp;nbsp;Here i will explain how to export particular column data from table. we can store the output in .sql or .csv file. In this method the output data will store in a file with newline (\n) separaters. &lt;br /&gt;
&lt;br /&gt;
The syntax is :&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;SELECT column_name FROM table_name INTO   OUTFILE &#39;/opt/lampp/htdocs/fileName.sql&#39;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The above syntax is store the output file in .sql format. you can change the format what you need. In the below example i will make the ooutput file in .csv format.&lt;br /&gt;
&lt;br /&gt;
Example :&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;SELECT second_name FROM employee INTO OUTFILE &#39;/opt/lampp/htdocs/secondName.csv&#39;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Note :  Best to download output file with .csv format. because .csv file format import has many advanced option when we import data to db. you can export with CSV, .zip, .gzip, etc... format.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/8161749931743098255/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2013/08/export-particular-column-data-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/8161749931743098255'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/8161749931743098255'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2013/08/export-particular-column-data-from.html' title='Export particular column data from table in phpmyadmin'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzidjj0P8eFWM4aOdJZkkZQRot385kA9Q6SEekFavg56XQc3d-Atwp6NRV3K-Gkqp0BTO01rbGGj2KEmsFqwVPwoUaiWFytdrByIZq3YLb1YnNm9uNV7QbEQ6GS47c9PP3ErOguI6HBb4/s72-c/phpMyAdmin-Logo-798880.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-877795518683008136</id><published>2013-07-31T15:08:00.001+05:30</published><updated>2013-07-31T15:23:06.866+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>PHP - To Check Query Process</title><content type='html'>&lt;div class=&quot;mobile-photo&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgai1_2Or6T18rD7OMrofUSY1AtLgJJjrfdDh0CHw2LvJnvt3xBRQjgSRTEXhagJgJDqk2nyLffKa6YluYlf_rUa7JJzRumknrbtnn0tJy_CMlgkbHgrNs6XSQgu_HmHimO7rTvV2LbaM4/s1600/phpmysql-700369.jpeg&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgai1_2Or6T18rD7OMrofUSY1AtLgJJjrfdDh0CHw2LvJnvt3xBRQjgSRTEXhagJgJDqk2nyLffKa6YluYlf_rUa7JJzRumknrbtnn0tJy_CMlgkbHgrNs6XSQgu_HmHimO7rTvV2LbaM4/s320/phpmysql-700369.jpeg&quot; id=&quot;BLOGGER_PHOTO_ID_5906711763515076466&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;PHP - To Check Query Process:
&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Here i will explain how to check the mysql query processing by using php. This function shows you which threads are running.&lt;br /&gt;
&lt;br /&gt;
Here i&#39;m using &quot;SHOW FULL PROCESSLIST&quot; mysql command. This command is very useful if you get the &quot;too many connections&quot; error message and want to find out what is going on. The output shows the current running threads process id. You can use that id to kill that process.
&lt;br /&gt;
&lt;br /&gt;
php program is:
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;mysql_connect(&quot;localhost&quot;,&quot;root&quot;,&quot;&quot;); // here we set localhost, username and password
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;$q = mysql_query(&quot;SHOW FULL PROCESSLIST&quot;); // here we run the mysql query
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;echo &quot;&amp;amp;lt;table border=&#39;1&#39;&amp;amp;gt;&quot;;
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;while($l = mysql_fetch_row($q) ) {
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;echo &quot;&amp;amp;lt;tr&amp;amp;gt;&quot;;
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;foreach($l as $val)
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;echo &quot;&amp;amp;lt;td&amp;amp;gt;$val&amp;amp;nbsp;&amp;amp;lt;/td&amp;amp;gt;&quot;;
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;echo &quot;&amp;amp;lt;/tr&amp;amp;gt;&quot;;
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;}
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;echo &quot;&amp;amp;lt;/table&amp;amp;gt;&quot;;
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;mysql_close();
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Note : The &quot;SHOW FULL PROCESSLIST&quot; command only shows you which &lt;br /&gt;
threads are running.  If you do not use the FULL keyword, only the first 100 characters of each statement are shown in the Info field.</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/877795518683008136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2013/07/php-to-check-query-process.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/877795518683008136'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/877795518683008136'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2013/07/php-to-check-query-process.html' title='PHP - To Check Query Process'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgai1_2Or6T18rD7OMrofUSY1AtLgJJjrfdDh0CHw2LvJnvt3xBRQjgSRTEXhagJgJDqk2nyLffKa6YluYlf_rUa7JJzRumknrbtnn0tJy_CMlgkbHgrNs6XSQgu_HmHimO7rTvV2LbaM4/s72-c/phpmysql-700369.jpeg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-6982999856635107576</id><published>2013-07-30T15:05:00.001+05:30</published><updated>2013-07-30T15:09:42.182+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>PHP to get yesterday(previous) date</title><content type='html'>&lt;div class=&quot;mobile-photo&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;mobile-photo&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJMDrGmDL85hNrrmutQdjTGwXgrsQPgg5hqpRz8gE0uuy2Uak92IpcnpKnKq9qG6yxc5N8_p1wvucw5jvddqAGDzutRGtSYqc4may9yVc0ndFIFGXtWrXUNqdWunXiF0T1jDe0bnWjGu0/s1600/php-to-get-yesterday-date-techniqzone.blogspot.in-727064.jpg&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5906339931592383810&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJMDrGmDL85hNrrmutQdjTGwXgrsQPgg5hqpRz8gE0uuy2Uak92IpcnpKnKq9qG6yxc5N8_p1wvucw5jvddqAGDzutRGtSYqc4may9yVc0ndFIFGXtWrXUNqdWunXiF0T1jDe0bnWjGu0/s320/php-to-get-yesterday-date-techniqzone.blogspot.in-727064.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;PHP to get yesterday(previous) date:&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Here are some methods to get the previous date using php. i.e.,)
&lt;br /&gt;
yesterday date.
&lt;br /&gt;
Here date() function is used and &quot;D d-M-Y&quot; format is used, it will
&lt;br /&gt;
return the date format like &quot;MON 29-Jul-2013&quot;.
&lt;br /&gt;
&lt;br /&gt;
Let we go to some examples to get the yesterday date in php.
&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;1. echo date(&quot;D d-M-Y&quot;, time() - 60 * 60 * 24);
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;2. $pDate = new DateTime();
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;$pDate-&amp;gt;add(DateInterval::createFromDateString(&#39;yesterday&#39;));
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;echo $pDate-&amp;gt;format(&#39;D d-M-Y&#39;);
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;3. echo date(&quot;D d-M-Y&quot;, strtotime(&quot;yesterday&quot;));
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;4. echo date(&quot;D d-M-Y&quot;, strtotime(&#39;-1 days&#39;));
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;5. echo date(&#39;D d-M-Y&#39;, time() - 86400);
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;6. echo date(&quot;D d-M-Y&quot;, mktime(0, 0, 0, date(&quot;m&quot;) , date(&quot;d&quot;)-1,date(&quot;Y&quot;)));
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
These all are return the date in same format like &quot;MON 29-Jul-2013&quot;;
&lt;br /&gt;
&lt;br /&gt;
If you want some other date format then consider the below examples.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;date(&quot;D d-M-Y&quot;);                       // TUE 30-Jul-2013
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;date(&quot;F j, Y, g:i a&quot;);                 // July 30, 2013, 3:10 pm
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;date(&quot;m.d.y&quot;);                         // 07.30.13
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;date(&quot;j, n, Y&quot;);                       // 30, 7, 2013
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;date(&quot;Y-m-d H:i:s&quot;);                   // 2013-07-30 11:22:14
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;date(&#39;h-i-s, j-m-y, it is w Day&#39;);     // 03-10-41, 30-07-13, 2031
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;2045 2 Tueam13
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;date(&#39;\i\t \i\s \t\h\e jS \d\a\y.&#39;);   // it is the 30th day.
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;date(&quot;D M j G:i:s T Y&quot;);               // Tue Jul 30 11:21:03 CEST 2013
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;date(&#39;H:m:s \m \i\s\ \m\o\n\t\h&#39;);     // 11:07:36 m is month
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;date(&quot;H:i:s&quot;);                         // 11:21:48
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;date(&quot;Ymd&quot;);                           // 20130730
&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Here you can see the attribute are used in date() function is &quot;D,d,m,y,Y,M,H,m,s,i,a,A&quot;.
&lt;br /&gt;
so you can modify it as what format you want like &quot;date(D d/m/Y)&quot;. etc...
&lt;br /&gt;
&lt;br /&gt;
If you have any queries comments it. Sorry for my poor english.</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/6982999856635107576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2013/07/php-to-get-yesterdayprevious-date.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/6982999856635107576'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/6982999856635107576'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2013/07/php-to-get-yesterdayprevious-date.html' title='PHP to get yesterday(previous) date'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJMDrGmDL85hNrrmutQdjTGwXgrsQPgg5hqpRz8gE0uuy2Uak92IpcnpKnKq9qG6yxc5N8_p1wvucw5jvddqAGDzutRGtSYqc4may9yVc0ndFIFGXtWrXUNqdWunXiF0T1jDe0bnWjGu0/s72-c/php-to-get-yesterday-date-techniqzone.blogspot.in-727064.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-3873324276235828611</id><published>2013-07-14T12:32:00.001+05:30</published><updated>2013-07-14T12:32:37.778+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><title type='text'>Increase Import Maximum file size in phpmyadmin</title><content type='html'>&lt;strong&gt;Increase Import Maximum file size in phpmyadmin&lt;/strong&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;border-bottom: medium none; border-left: medium none; border-right: medium none; border-top: medium none; clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhA2rHDcMP3jBBADR9y2vhqBWFYUEeuHAqTn76D6Mz8J_syzxKaCgNLxQFjV-q6JuDrAra-rX4-6LMxx4tyA-e6Qu4lBwSqtoJxUGrDhigAo-bWJkhnkfBQH0lbuI5BVWFsXwrWNaMkYQg/s1600/download+%25281%2529.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; cssfloat: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; nya=&quot;true&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhA2rHDcMP3jBBADR9y2vhqBWFYUEeuHAqTn76D6Mz8J_syzxKaCgNLxQFjV-q6JuDrAra-rX4-6LMxx4tyA-e6Qu4lBwSqtoJxUGrDhigAo-bWJkhnkfBQH0lbuI5BVWFsXwrWNaMkYQg/s1600/download+%25281%2529.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;br /&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;nbsp; Here are the steps to increase the import file size in phpmyadmin. Usually phpmyadmin allows to import sql files maximum of 2M (i.e 2,048kb). To increase the maximum file size do the following changes in php.ini file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you are using&amp;nbsp; windows ,the php&amp;nbsp;configuration file can be located in your server (wampp or xampp) -&amp;gt; php folder. &lt;br /&gt;
&lt;br /&gt;
Find&lt;br /&gt;
&amp;nbsp;&lt;strong&gt;upload_max_filesize =2M&lt;/strong&gt;&lt;br /&gt;
in the file,&lt;br /&gt;
change the value acording to your need. Here I changed the value to 10M&amp;nbsp;i.e , it allows to import sql files maximum of 10 Mb.&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;upload_max_filesize = 10M&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; </content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/3873324276235828611/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2013/07/increase-import-maximum-file-size-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/3873324276235828611'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/3873324276235828611'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2013/07/increase-import-maximum-file-size-in.html' title='Increase Import Maximum file size in phpmyadmin'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhA2rHDcMP3jBBADR9y2vhqBWFYUEeuHAqTn76D6Mz8J_syzxKaCgNLxQFjV-q6JuDrAra-rX4-6LMxx4tyA-e6Qu4lBwSqtoJxUGrDhigAo-bWJkhnkfBQH0lbuI5BVWFsXwrWNaMkYQg/s72-c/download+%25281%2529.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-6188565258644724300</id><published>2013-07-14T11:28:00.002+05:30</published><updated>2013-07-14T11:28:33.767+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>Replace MS Word single quotes in PHP</title><content type='html'>&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;Replace MS Word single quotes in PHP:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s1600/images+%25282%2529.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Replace MS Word single quotes in PHP&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s1600/images+%25282%2529.jpg&quot; title=&quot;Replace MS Word single quotes in PHP&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&amp;nbsp;The following function is used to replace Microsoft-encoded quotes in PHP.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;function replaeQuotes($str)&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;{&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp; &amp;nbsp; $str1 = array(chr(145),chr(146), chr(147), chr(148), chr(151));&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp; &amp;nbsp; $str2 = array(&quot;&#39;&quot;, &quot;&#39;&quot;,&#39;&quot;&#39;,&#39;&quot;&#39;,&#39;-&#39;);&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp; &amp;nbsp; return str_replace($str1, $str2, $str);&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;}&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
For Ex:&lt;br /&gt;
&lt;br /&gt;
In php,&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;$str=&quot;&#39;This is TechniqZone&#39;-For Developers&quot;;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;$clearStr=replaeQuotes($str);&lt;/span&gt;&lt;/b&gt;</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/6188565258644724300/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2013/07/replace-ms-word-single-quotes-in-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/6188565258644724300'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/6188565258644724300'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2013/07/replace-ms-word-single-quotes-in-php.html' title='Replace MS Word single quotes in PHP'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s72-c/images+%25282%2529.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-7446929119219294244</id><published>2013-07-14T11:15:00.001+05:30</published><updated>2013-07-14T11:15:56.444+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="HTML"/><title type='text'>Remove MS Word special character symbol in html</title><content type='html'>&lt;b&gt;&lt;span style=&quot;color: #a64d79; font-size: large;&quot;&gt;Remove MS Word special character symbol in html :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;To remove the MS Word special character in html page or website page you just add the bellow header meta tag in your header field.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;lt;META http-equiv=&quot;Content-type&quot; content=&quot;text/html; charset=iso-8859-1&quot;&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
Note: In some case the above meta tag will work individually, ie.,) No need to add any other meta tag with this.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7TIRoQeQHMmgdbP995udnRP7hCFZD3alOoCO3Kaf1pB7YB0WJT58kbPbM1mqkhmf17PJ1DuERFpsmywJaVxMd1f0ddeztesMv-1_BQO-wC1aQfN6orY5NsWwIe0ax8gnBJ4_yl8Yioro/s1600/oie_oie_canvas%25281%2529.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Remove MS Word special character symbol in html&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7TIRoQeQHMmgdbP995udnRP7hCFZD3alOoCO3Kaf1pB7YB0WJT58kbPbM1mqkhmf17PJ1DuERFpsmywJaVxMd1f0ddeztesMv-1_BQO-wC1aQfN6orY5NsWwIe0ax8gnBJ4_yl8Yioro/s1600/oie_oie_canvas%25281%2529.png&quot; title=&quot;Remove MS Word special character symbol in html&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/7446929119219294244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2013/07/remove-ms-word-special-character-symbol.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/7446929119219294244'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/7446929119219294244'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2013/07/remove-ms-word-special-character-symbol.html' title='Remove MS Word special character symbol in html'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi7TIRoQeQHMmgdbP995udnRP7hCFZD3alOoCO3Kaf1pB7YB0WJT58kbPbM1mqkhmf17PJ1DuERFpsmywJaVxMd1f0ddeztesMv-1_BQO-wC1aQfN6orY5NsWwIe0ax8gnBJ4_yl8Yioro/s72-c/oie_oie_canvas%25281%2529.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-1670838589762888080</id><published>2013-07-11T06:30:00.000+05:30</published><updated>2013-07-11T06:30:02.910+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="HTML"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>PHP Remove HTML tags from a String</title><content type='html'>&lt;b&gt;&lt;span style=&quot;color: #a64d79; font-size: large;&quot;&gt;PHP Remove HTML tags from a String :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s1600/images+%25282%2529.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;PHP Remove HTML tags from a String&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s1600/images+%25282%2529.jpg&quot; title=&quot;PHP Remove HTML tags from a String&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&amp;nbsp;The following code is used to remove the html tags from string.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;?php&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;$input=&quot;Hi this is &amp;lt;b&amp;gt;TechniqZone&amp;lt;/b&amp;gt;&quot;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;$text = strip_tags($input, &quot;&quot;);&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;echo $text;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;?&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Output is &lt;span style=&quot;color: #674ea7;&quot;&gt;Hi this is TechniqZone.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The above code remove all html tags from string.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here strip_tags() function is used to remove tags from string.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;type&quot; style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 14px;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: verdana, arial, helvetica, sans-serif; font-size: 14px;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;methodname&quot; style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 14px;&quot;&gt;&lt;strong&gt;strip_tags&lt;/strong&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: verdana, arial, helvetica, sans-serif; font-size: 14px;&quot;&gt;&amp;nbsp;(&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;methodparam&quot; style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 14px;&quot;&gt;&lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;&amp;nbsp;&lt;code class=&quot;parameter&quot; style=&quot;font-family: Consolas, &#39;Andale Mono WT&#39;, &#39;Andale Mono&#39;, &#39;Lucida Console&#39;, Monaco, &#39;Courier New&#39;, Courier, monospace; font-style: italic;&quot;&gt;$str&lt;/code&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: verdana, arial, helvetica, sans-serif; font-size: 14px;&quot;&gt;&amp;nbsp;[,&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;methodparam&quot; style=&quot;font-family: verdana, arial, helvetica, sans-serif; font-size: 14px;&quot;&gt;&lt;span class=&quot;type&quot;&gt;string&lt;/span&gt;&amp;nbsp;&lt;code class=&quot;parameter&quot; style=&quot;font-family: Consolas, &#39;Andale Mono WT&#39;, &#39;Andale Mono&#39;, &#39;Lucida Console&#39;, Monaco, &#39;Courier New&#39;, Courier, monospace; font-style: italic;&quot;&gt;$allowable_tags&lt;/code&gt;&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: verdana, arial, helvetica, sans-serif; font-size: 14px;&quot;&gt;&amp;nbsp;] )&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white; font-family: verdana, arial, helvetica, sans-serif; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;background-color: white; font-size: 14px;&quot;&gt;&lt;span style=&quot;font-family: verdana, arial, helvetica, sans-serif;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: verdana, arial, helvetica, sans-serif;&quot;&gt;$allowable_tags - You can use the optional second parameter to specify tags which should not be stripped.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;$input=&quot;Hi this is lt;a href=&#39;http://techniqzone.blogspot.in&#39;&amp;gt;&amp;lt;b&amp;gt;TechniqZone&amp;lt;/b&amp;gt;lt;/a&amp;gt;&quot;;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;$text = strip_tags($input, &quot;&amp;lt;b&amp;gt;&quot;);&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;echo $text;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Output is&lt;span style=&quot;color: #674ea7;&quot;&gt; Hi this is &lt;b&gt;TechniqZone.&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
Here i allowed&lt;b&gt; &amp;lt;b&amp;gt;&lt;/b&gt; tag from string.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/1670838589762888080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2013/07/php-remove-html-tags-from-string.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/1670838589762888080'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/1670838589762888080'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2013/07/php-remove-html-tags-from-string.html' title='PHP Remove HTML tags from a String'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s72-c/images+%25282%2529.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-1848650385123645951</id><published>2013-07-11T03:00:00.000+05:30</published><updated>2013-07-11T03:00:01.864+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>Display Current Indian Standard Time using PHP</title><content type='html'>&lt;b&gt;&lt;span style=&quot;color: #a64d79; font-size: large;&quot;&gt;Display Current Indian Standard Time using PHP :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;img alt=&quot;display indian standard time php&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s1600/images+%25282%2529.jpg&quot; title=&quot;display indian standard time php&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;br /&gt;
&amp;nbsp;The following code is used to get the current indian standard time using php.&lt;br /&gt;
here the &lt;b&gt;default_timezone_set()&lt;/b&gt; function is used to set the country to set the particular time or date of that country.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;date_default_timezone_set(&#39;Asia/Calcutta&#39;);&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;echo date(&quot;h:i a&quot;);&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Output of above code is :&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #674ea7;&quot;&gt;&lt;b&gt;06:40 pm&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
if you want capital letters of am/pm then you just use date(&quot;h:i A&quot;). This will return &lt;b&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;06:40 PM&lt;/span&gt;&lt;/b&gt;.&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/1848650385123645951/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2013/07/display-current-indian-standard-time.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/1848650385123645951'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/1848650385123645951'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2013/07/display-current-indian-standard-time.html' title='Display Current Indian Standard Time using PHP'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s72-c/images+%25282%2529.jpg" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-7979425441202950664</id><published>2013-07-10T02:00:00.000+05:30</published><updated>2013-07-10T02:00:00.930+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>Php to convert UTC time to local time</title><content type='html'>&lt;b&gt;Php to convert UTC time to local time&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s1600/images+%25282%2529.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: center;&quot;&gt;&lt;img alt=&quot;Php to convert UTC time to local time&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s1600/images+%25282%2529.jpg&quot; title=&quot;Php to convert UTC time to local time&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Here is a simple code to convert UTC time to local time in php. The $dateInLocal displays the UTC time as localtime.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$time = strtotime($dateInUTC.&#39; UTC&#39;);&lt;br /&gt;
$dateInLocal = date(&quot;Y-m-d H:i:s&quot;, $time);&lt;br /&gt;
echo $dateInLocal;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/7979425441202950664/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2013/07/php-to-convert-utc-time-to-local-time.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/7979425441202950664'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/7979425441202950664'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2013/07/php-to-convert-utc-time-to-local-time.html' title='Php to convert UTC time to local time'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s72-c/images+%25282%2529.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-6393090943694741057</id><published>2013-07-09T03:00:00.000+05:30</published><updated>2013-07-09T03:00:00.100+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Mail"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>Attachment in mail using PHP</title><content type='html'>&lt;b&gt; Attachment in mail using PHP&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s1600/images+%25282%2529.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s1600/images+%25282%2529.jpg&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
In the previous post, I described HTML content in mails. In this post we can see how attachment in mails can be done using PHP .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$to = &#39;youraddress@example.com&#39;;&lt;br /&gt;
//define the subject of the email&lt;br /&gt;
$subject = &#39;Test email with attachment&#39;;&lt;br /&gt;
//create a boundary string. It must be unique&lt;br /&gt;
//so we use the MD5 algorithm to generate a random hash&lt;br /&gt;
$random_hash = md5(date(&#39;r&#39;, time()));&lt;br /&gt;
//define the headers we want passed. Note that they are separated with \r\n&lt;br /&gt;
$headers = &quot;From: webmaster@example.com\r\nReply-To: webmaster@example.com&quot;;&lt;br /&gt;
//add boundary string and mime type specification&lt;br /&gt;
$headers .= &quot;\r\nContent-Type: multipart/mixed; boundary=\&quot;PHP-mixed-&quot;.$random_hash.&quot;\&quot;&quot;;&lt;br /&gt;
//read the atachment file contents into a string,&lt;br /&gt;
//encode it with MIME base64,&lt;br /&gt;
//and split it into smaller chunks&lt;br /&gt;
$attachment = chunk_split(base64_encode(file_get_contents(&#39;attachment.zip&#39;)));&lt;br /&gt;
//define the body of the message.&lt;br /&gt;
ob_start(); //Turn on output buffering&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
--PHP-mixed-&lt;br /&gt;
Content-Type: multipart/alternative; boundary=&quot;PHP-alt-&quot;&lt;br /&gt;
&lt;br /&gt;
--PHP-alt-&lt;br /&gt;
Content-Type: text/plain; charset=&quot;iso-8859-1&quot;&lt;br /&gt;
Content-Transfer-Encoding: 7bit&lt;br /&gt;
&lt;br /&gt;
Hello World!!!&lt;br /&gt;
This is simple text email message.&lt;br /&gt;
&lt;br /&gt;
--PHP-alt-&lt;br /&gt;
Content-Type: text/html; charset=&quot;iso-8859-1&quot;&lt;br /&gt;
Content-Transfer-Encoding: 7bit&lt;br /&gt;
&lt;h1&gt;
&lt;span style=&quot;background-color: white; color: #555555; font-family: arial, verdana, sans-serif; font-size: 12px; line-height: 15.59375px;&quot;&gt;&lt;a href=&quot;http://techniqzone.blogspot.in/&quot;&gt;TechniqZone&lt;/a&gt; Is Help To Guide Developers issues&lt;/span&gt;&lt;/h1&gt;
&lt;br /&gt;
&lt;br /&gt;
This is something with &lt;b&gt;HTML&lt;/b&gt; formatting.&lt;br /&gt;
&lt;br /&gt;
--PHP-alt---&lt;br /&gt;
&lt;br /&gt;
--PHP-mixed-&lt;br /&gt;
Content-Type: application/zip; name=&quot;attachment.zip&quot;&lt;br /&gt;
Content-Transfer-Encoding: base64&lt;br /&gt;
Content-Disposition: attachment&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--PHP-mixed---&lt;br /&gt;
&lt;br /&gt;
//copy current buffer contents into $message variable and delete current output buffer&lt;br /&gt;
$message = ob_get_clean();&lt;br /&gt;
//send the email&lt;br /&gt;
$mail_sent = @mail( $to, $subject, $message, $headers );&lt;br /&gt;
//if the message is sent successfully print &quot;Mail sent&quot;. Otherwise print &quot;Mail failed&quot;&lt;br /&gt;
echo $mail_sent ? &quot;Mail sent&quot; : &quot;Mail failed&quot;;&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/6393090943694741057/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2013/07/attachment-in-mail-using-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/6393090943694741057'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/6393090943694741057'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2013/07/attachment-in-mail-using-php.html' title='Attachment in mail using PHP'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s72-c/images+%25282%2529.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-9202706159560358764</id><published>2013-07-08T07:00:00.000+05:30</published><updated>2013-07-08T07:00:01.242+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>PHP to Determine Page Execution Time</title><content type='html'>&lt;b&gt;&lt;span style=&quot;color: #a64d79; font-size: large;&quot;&gt;PHP to Determine Page Execution Time :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s1600/images+%25282%2529.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;PHP to Determine Page Execution Time&quot; border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s1600/images+%25282%2529.jpg&quot; title=&quot;PHP to Determine Page Execution Time&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;br /&gt;
The below code is used to find the php page execution time.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Just paste the below code in header portion in php page.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp; &amp;nbsp;$time = microtime();&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp; &amp;nbsp;$time = explode(&quot; &quot;,$time);&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp; &amp;nbsp;$time = $time[1] + $time[0];&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp; &amp;nbsp;$starttime = $time;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;;?&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
after the above code you can add other html or php codes.&lt;br /&gt;
&lt;br /&gt;
and paste the below code in footer page of same php file.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;lt;?php&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp; &amp;nbsp;$time = microtime();&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp; &amp;nbsp;$time = explode(&quot; &quot;,$time);&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp; &amp;nbsp;$time = $time[1] + $time[0];&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp; &amp;nbsp;$endtime = $time;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp; &amp;nbsp;$totaltime = ($endtime - $starttime);&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp; &amp;nbsp;echo &quot;This page execution time is &quot;.$totaltime.&quot; seconds&quot;;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;;?&amp;gt;&lt;/span&gt;&lt;/b&gt;</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/9202706159560358764/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2013/07/php-to-determine-page-execution-time.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/9202706159560358764'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/9202706159560358764'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2013/07/php-to-determine-page-execution-time.html' title='PHP to Determine Page Execution Time'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s72-c/images+%25282%2529.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-789981639795952655</id><published>2013-07-07T18:30:00.000+05:30</published><updated>2013-07-07T18:30:06.243+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Mail"/><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>Sending Nice HTML Email with PHP</title><content type='html'>&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79; font-size: large;&quot;&gt;Sending Nice HTML Email with PHP :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s1600/images+%25282%2529.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s1600/images+%25282%2529.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Everyone wishes to include Html content in their mails. Here is a sample code to send a mail with HTML content. You can edit the HTML content as you prefer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$to = &#39;sample@example.com&#39;;&lt;br /&gt;
&lt;br /&gt;
$subject = &#39;Sample HTML content&#39;;&lt;br /&gt;
&lt;br /&gt;
$headers = &quot;From: &quot; . strip_tags($_POST[&#39;req-email&#39;]) . &quot;\r\n&quot;;&lt;br /&gt;
$headers .= &quot;Reply-To: &quot;. strip_tags($_POST[&#39;req-email&#39;]) . &quot;\r\n&quot;;&lt;br /&gt;
$headers .= &quot;CC: susan@example.com\r\n&quot;;&lt;br /&gt;
$headers .= &quot;MIME-Version: 1.0\r\n&quot;;&lt;br /&gt;
$headers .= &quot;Content-Type: text/html; charset=ISO-8859-1\r\n&quot;;&lt;br /&gt;
&lt;br /&gt;
$message = &#39;&amp;lt;h1&amp;gt;&#39;;&lt;html&gt;&lt;body&gt;&#39;;&lt;/body&gt;&lt;/html&gt;&lt;br /&gt;
$message .= &#39;&amp;lt;a href=&#39;http://techniqzone.blogspot.in/&#39;&amp;gt;TechniqZone&amp;lt;/a&amp;gt; Is Help To Guide Developers issues.&#39;;&lt;br /&gt;
$message .= &#39;&amp;lt;/h1&amp;gt;&#39;;&lt;br /&gt;
mail($to, $subject, $message, $headers);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$message contains HTML content. And the HTML content will be executed in the mail.&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/789981639795952655/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2013/07/sending-nice-html-email-with-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/789981639795952655'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/789981639795952655'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2013/07/sending-nice-html-email-with-php.html' title='Sending Nice HTML Email with PHP'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s72-c/images+%25282%2529.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-523141459744787406</id><published>2013-07-07T18:23:00.002+05:30</published><updated>2013-07-07T18:23:37.965+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>PHP Get Last 12 Months</title><content type='html'>&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s1600/images+%25282%2529.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s1600/images+%25282%2529.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79; font-size: large;&quot;&gt;PHP to get last 12 months :&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;The following coding is used to get previous 12 months by using PHP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;for ($t = 1; $t &amp;lt;= 12; $t++) {&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp; &amp;nbsp; echo date(&quot;F Y m&quot;, strtotime( date( &#39;Y-m-01&#39; ).&quot; -$t months&quot;));&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp; &amp;nbsp; echo &quot;&amp;lt;br /&amp;gt;&quot;;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;}&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&amp;nbsp;Output of this code is :&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #674ea7;&quot;&gt;June 2013 06&lt;br /&gt;May 2013 05&lt;br /&gt;April 2013 04&lt;br /&gt;March 2013 03&lt;br /&gt;February 2013 02&lt;br /&gt;January 2013 01&lt;br /&gt;December 2012 12&lt;br /&gt;November 2012 11&lt;br /&gt;October 2012 10&lt;br /&gt;September 2012 09&lt;br /&gt;August 2012 08&lt;br /&gt;July 2012 07&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Here date &quot;F Y m&quot; is used to make the date format in above format. you can store these dates in arrat also by using below code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;for ($t = 1; $t &amp;lt;= 12; $t++) {&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp; &amp;nbsp; $mnt[]= date(&quot;F Y m&quot;, strtotime( date( &#39;Y-m-01&#39; ).&quot; -$t months&quot;));&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;}&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here $mnt is php array variable with last 12 months.&lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/523141459744787406/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2013/07/php-get-last-12-months.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/523141459744787406'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/523141459744787406'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2013/07/php-get-last-12-months.html' title='PHP Get Last 12 Months'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s72-c/images+%25282%2529.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-1274869717849024630</id><published>2013-06-17T02:30:00.000+05:30</published><updated>2013-06-17T02:30:02.016+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="PHP"/><title type='text'>Get all images from folder - php</title><content type='html'>&lt;b&gt;&lt;span style=&quot;color: #a64d79; font-size: large;&quot;&gt;Get all images from folder - php:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&amp;nbsp;The below code is used to get all images from folder in local system. we can set the condition for file type to read files from particular directory in php.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;$imgdir = &#39;images/&#39;;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;$allowed_types = array(&#39;png&#39;,&#39;jpg&#39;,&#39;jpeg&#39;,&#39;gif&#39;);&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;$dimg = opendir($imgdir);&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;while($imgfile = readdir($dimg))&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;{&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp; if( in_array(strtolower(substr($imgfile,-3)),$allowed_types) OR&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; in_array(strtolower(substr($imgfile,-4)),$allowed_types) )&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;/*If the file is an image add it to the array*/&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp; {$a_img[] = $imgfile;}&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;}&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;echo &quot;&amp;lt;ul&amp;gt;&quot;;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp;$totimg = count($a_img);&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&amp;nbsp;for($x=0; $x &amp;lt; $totimg; $x++)&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;{&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;echo &quot;&amp;lt;li&amp;gt;&amp;lt;img src=&#39;&quot; . $imgdir . $a_img[$x] . &quot;&#39; /&amp;gt;&amp;lt;/li&amp;gt;&quot;;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;}&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;echo &quot;&amp;lt;/ul&amp;gt;&quot;;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;In the above coe $imgdir is used to pick your directory. $allowed_type is used to set the type of files u allowed from folder to pickup.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
opendir() function is used to open your given folder to read it.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
readdir() is used to read folder. the while loop is read all files from folder and push the allowed type files in $a_img array.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now we can print all image name by using for loop or any other method.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s1600/images+%25282%2529.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s1600/images+%25282%2529.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/1274869717849024630/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2013/06/get-all-images-from-folder-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/1274869717849024630'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/1274869717849024630'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2013/06/get-all-images-from-folder-php.html' title='Get all images from folder - php'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYneRwNLGCcfwPBL_omCBUqOeuDI14IMClp-UaE1ReOWk0EQBZ6pU8RLLoLRRJmnWN3HKe0dOgBBFj-oSivWxKbXC9r8sr_G74hYad9aTeJo5UuklXk4bAy_qtddF3AM_zFbNOtlWAZRw/s72-c/images+%25282%2529.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-8532398064764545220</id><published>2013-06-16T19:24:00.001+05:30</published><updated>2013-06-16T19:24:33.478+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Javascript"/><title type='text'>Javascript popup window to return value to parent window</title><content type='html'>&lt;b&gt;&lt;span style=&quot;color: #a64d79; font-size: large;&quot;&gt;Javascript popup window to return value to parent window:&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;color: #a64d79; font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;
&amp;nbsp;We can pass the values to child window to parent window by using javascript. These passing methodology working with html tags and javascript functions.&lt;br /&gt;
&lt;br /&gt;
The javascript popup window is used to get the external value like select the region from map etc.&lt;br /&gt;
&lt;br /&gt;
Follow the below html programs to pass the value from javascript popup window..&lt;br /&gt;
&lt;br /&gt;
parent.html :&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;html&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;head&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=windows-1252&quot;&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;title&amp;gt;Opener&amp;lt;/title&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;script type=&#39;text/javascript&#39;&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;function valideopenerform(){&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;var popy= window.open(&#39;popup.html&#39;,&#39;popup_form&#39;,&#39;location=no,menubar=no,status=no,top=50%,left=50%,height=550,width=750&#39;)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;/script&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;/head&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;body&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;form name=&#39;form1&#39; id=&#39;form1&#39; &amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;input type=&#39;text&#39; id=&#39;text1&#39; name=&#39;text1&#39; /&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;input type=&#39;button&#39; value=&#39;go&#39; onclick=&#39;valideopenerform()&#39; /&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;/form&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;/body&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;/html&amp;gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&amp;nbsp;In this first html&amp;nbsp;&lt;b style=&quot;color: #a64d79;&quot;&gt;valideopenerform() &lt;/b&gt;is i used. in this function i called the second html for open as a popup window. and createone text field with the id &quot;text1&quot;. i &#39;&#39; return the value to this text field from popup window.&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
popup.html&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;html&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;head&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=windows-1252&quot;&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;title&amp;gt;Opener&amp;lt;/title&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;script type=&#39;text/javascript&#39;&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;function validepopupform(){&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;window.opener.document.form1.text1.value=document.form2.text2.value;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;self.close();&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;/script&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;/head&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;body&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;form id=&#39;form2&#39; name=&#39;form2&#39; &amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;input type=&#39;text&#39; id=&#39;text2&#39; name=&#39;text2&#39; /&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;input type=&#39;button&#39; value=&#39;go&#39; onclick=&#39;validepopupform()&#39; /&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;/form&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;/body&amp;gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #a64d79;&quot;&gt;&lt;b&gt;&amp;lt;/html&amp;gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp;In this second html i used&amp;nbsp;&lt;b style=&quot;color: #a64d79;&quot;&gt;validepopupform() &lt;/b&gt;to return the value to parent window text field by using text field id(text1).&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now the value passed to the parent window text field.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHhkboCBzZSZ_xFKo9bpSJv4NIHlowHlQtjEGS7TxU8s2Z5jPZfoziN7QgGLEYE7ML4CfR9_7abjRkaIAJbY1FuqkvG8nTExlVT6VeV8RTOCY4Mtci7fHH_hqMRdoB5ukgPsjoBgoG7w0/s1600/images+%25285%2529.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHhkboCBzZSZ_xFKo9bpSJv4NIHlowHlQtjEGS7TxU8s2Z5jPZfoziN7QgGLEYE7ML4CfR9_7abjRkaIAJbY1FuqkvG8nTExlVT6VeV8RTOCY4Mtci7fHH_hqMRdoB5ukgPsjoBgoG7w0/s1600/images+%25285%2529.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/8532398064764545220/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2013/06/javascript-popup-window-to-return-value.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/8532398064764545220'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/8532398064764545220'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2013/06/javascript-popup-window-to-return-value.html' title='Javascript popup window to return value to parent window'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHhkboCBzZSZ_xFKo9bpSJv4NIHlowHlQtjEGS7TxU8s2Z5jPZfoziN7QgGLEYE7ML4CfR9_7abjRkaIAJbY1FuqkvG8nTExlVT6VeV8RTOCY4Mtci7fHH_hqMRdoB5ukgPsjoBgoG7w0/s72-c/images+%25285%2529.jpg" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1859388405414689578.post-594522801470410978</id><published>2013-05-26T23:16:00.000+05:30</published><updated>2013-06-08T09:52:46.980+05:30</updated><title type='text'>Rounding Numbers to ‘N’ Decimal</title><content type='html'>&lt;span style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #a64d79; display: inline !important; float: none; font-size: large; font: 13px/18px Verdana, Arial, Helvetica, sans-serif; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;strong&gt;Rounding Numbers to ‘N’ Decimal&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font: 13px/18px Verdana, Arial, Helvetica, sans-serif; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font: 13px/18px Verdana, Arial, Helvetica, sans-serif; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span class=&quot;Apple-converted-space&quot;&gt;&amp;nbsp;This&lt;/span&gt; will let&amp;nbsp;you round off a number to ‘N’ decimal places. In the below &lt;span style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font: 13px/18px Verdana, Arial, Helvetica, sans-serif; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;example we are rounding of a number to 2 decimal places.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font: 13px/18px Verdana, Arial, Helvetica, sans-serif; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font: 13px/18px Verdana, Arial, Helvetica, sans-serif; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font: 13px/18px Verdana, Arial, Helvetica, sans-serif; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;pre style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; word-wrap: break-word;&quot;&gt;&lt;span style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font: 13px/18px Verdana, Arial, Helvetica, sans-serif; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font: 13px/18px Verdana, Arial, Helvetica, sans-serif; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font: 13px/18px Verdana, Arial, Helvetica, sans-serif; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;var num = 4.56789;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;span style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font: 13px/18px Verdana, Arial, Helvetica, sans-serif; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font: 13px/18px Verdana, Arial, Helvetica, sans-serif; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;span style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font: 13px/18px Verdana, Arial, Helvetica, sans-serif; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;
&lt;pre style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; word-wrap: break-word;&quot;&gt;alert(num.toFixed(2));&lt;/pre&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; word-wrap: break-word;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; word-wrap: break-word;&quot;&gt;
It will alert as 4.56.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; word-wrap: break-word;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; word-wrap: break-word;&quot;&gt;
Another function to display a number upto a length is &lt;span style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font: 13px/18px monospace; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;toPrecision(x).&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; word-wrap: break-word;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; display: inline !important; float: none; font: 13px/18px monospace; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;&quot;&gt;&lt;pre style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; word-wrap: break-word;&quot;&gt;num = 520.2375;
result = num.toPrecision(4);&lt;/pre&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; word-wrap: break-word;&quot;&gt;
alert(result);&lt;/div&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; word-wrap: break-word;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; word-wrap: break-word;&quot;&gt;
It will display as 520.2.&lt;/div&gt;
&lt;div style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; word-wrap: break-word;&quot;&gt;
&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHhkboCBzZSZ_xFKo9bpSJv4NIHlowHlQtjEGS7TxU8s2Z5jPZfoziN7QgGLEYE7ML4CfR9_7abjRkaIAJbY1FuqkvG8nTExlVT6VeV8RTOCY4Mtci7fHH_hqMRdoB5ukgPsjoBgoG7w0/s1600/images+%25285%2529.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHhkboCBzZSZ_xFKo9bpSJv4NIHlowHlQtjEGS7TxU8s2Z5jPZfoziN7QgGLEYE7ML4CfR9_7abjRkaIAJbY1FuqkvG8nTExlVT6VeV8RTOCY4Mtci7fHH_hqMRdoB5ukgPsjoBgoG7w0/s1600/images+%25285%2529.jpg&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align=&quot;center&quot; style=&quot;-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: black; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 18px; text-indent: 0px; text-transform: none; white-space: pre-wrap; word-spacing: 0px; word-wrap: break-word;&quot;&gt;
﻿&lt;/div&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='https://techniqzone.blogspot.com/feeds/594522801470410978/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://techniqzone.blogspot.com/2013/05/rounding-numbers-to-n-decimal.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/594522801470410978'/><link rel='self' type='application/atom+xml' href='https://www.blogger.com/feeds/1859388405414689578/posts/default/594522801470410978'/><link rel='alternate' type='text/html' href='https://techniqzone.blogspot.com/2013/05/rounding-numbers-to-n-decimal.html' title='Rounding Numbers to ‘N’ Decimal'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHhkboCBzZSZ_xFKo9bpSJv4NIHlowHlQtjEGS7TxU8s2Z5jPZfoziN7QgGLEYE7ML4CfR9_7abjRkaIAJbY1FuqkvG8nTExlVT6VeV8RTOCY4Mtci7fHH_hqMRdoB5ukgPsjoBgoG7w0/s72-c/images+%25285%2529.jpg" height="72" width="72"/><thr:total>0</thr:total></entry></feed>