Blog

how to get next day date in php?

<?php $todayDate = date("Y-m-d");// current date echo "Today: ".$todayDate."<br>"; //Add one day to today $date = strtotime(date("Y-m-d", strtotime($todayDate)) . " +1 day"); echo "After ad

View More

PHP method chaining

<p>function addA() {</p> <p>$this-&gt;str .= &quot;a&quot;;</p> <p>return $this;</p> <p>}</p> <p>function addB() {</p> <p>$this-&gt;str .= &quot;b&quot;;</p> <p>return $this;</p>

View More

How to count no. of days between two dates in PHP

<p>&lt;?php</p> <p>function dateDiff($start, $end) {</p> <p>$start_ts = strtotime($start);</p> <p>$end_ts = strtotime($end);</p> <p>$diff = $end_ts - $start_ts;</p> <p>return round($dif

View More

how to get first four characters from string in PHP

<?php echo $x="wama software"; echo "<br>"; echo substr($x, 0, 4); //returns "wama" echo "<br>"; echo "<br>"; echo "Some other examples too.."; echo substr ($x, 0, 3); // outputs wam echo "

View More

strtotime() to date() format in php

&lt;?php $date = 1349733600; echo $time = date("Y-m-d",$date); &nbsp; //output :2012-10-09 ?&gt; &nbsp; &nbsp;

View More

how to convert 12 hour to 24 hours time

&lt;?php $time_ws="1:30 PM"; echo $time_24_hour_ws = date("H:i", strtotime($time_ws)); //13:30 echo $time_24_hour_ws = date("H:i:s", strtotime($time_ws)); //13:30:00 ?&gt; &nbsp; &nbsp;

View More

function to find and complete open html tags in php

<p>if($pos !== false) {</p> <p>$html = substr($html, 0,$length + $pos + 1); } else {</p> <p>$html = substr($html, 0,$length);</p> <p>}</p> <p>preg_match_all(&#39;#&lt;(?!meta|img|br|hr|inp

View More

How to remove special character for any string

<p>$mobile = &#39;(250) 9912-124-56.67&#39;;</p> <p>$mobile = preg_replace(&#39;/[^a-zA-Z0-9]/&#39;, &#39;&#39;, $mobile);</p> <p>echo $mobile;</p>

View More

How to get date after 40 days in php

&lt;?php $currentdate= date("Y-m-d"); //Current date $add_days = 40; // no of days $date_afterforty = date('Y-m-d',strtotime($currentdate) + (24*3600*$add_days)); // date after 40 days of current

View More

Seprate date, time from datetime

$createdatetime='2013-07-22 08:07:40'; $datetime = new DateTime($createdatetime); $createdate = $datetime-&gt;format('Y-m-d'); $createtime = $datetime-&gt;format('H:i:s');

View More

Cookies

<h2>* PHP Cookies :-</h2> <h2>What is a Cookie?</h2> A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user's computer. Each time the same computer re

View More

Sessions

<h2>* PHP Sessions :-</h2> <ul> <li>A PHP session variable is used to store information about, or change settings for a user session. Session variables hold information about one single user, and a

View More

PHP Database

<h2>What is MySQL ?</h2> <ul> <li>MySQL is a<strong> database system</strong> used on the web</li> <li>MySQL is a database system that <strong>runs on a server</strong></li> <li>MySQL is ideal

View More

PHP Function

<h2>* PHP Function :-</h2> <ul> <li>A function is a <strong>block of statements</strong> that can be used<strong> repeatedly</strong> in a program.</li> <li>A function <strong>will not</strong> e

View More

Technical Questions In Php :-

<h2><strong>1) What is PHP?</strong></h2> <ul> <li>PHP stands for PHP : Hypertext Preprocessor.</li> <li>PHP is a server side scripting language, like ASP</li> <li>PHP scripts are executed on t

View More

foreach loop

<h2></h2> <h2><strong>foreach loop</strong></h2> <ul> <li><span style="font-size: 13px;">The </span><em style="font-size: 13px;">foreach</em><span style="font-size: 13px;"> construct provides an e

View More

mail() Function

<h2>* PHP mail() Function :-</h2> <ul> <li> <h3><strong><span style="font-size: 13px;">The mail() function allows you to send emails directly from a script.</span></strong></h3> </li> </ul> <h2

View More

explode and implode function

<h2>* PHP  explode() Function :</h2> <ul> <li><span style="font-size: 13px;">The explode() function breaks a string into an array.</span></li> </ul> &nbsp; <h2><strong>Syntax :</strong></h2> <s

View More

how to get position from string in php

<h2>* <span style="text-decoration: underline;">PHP strrpos() Function :-</span></h2> <ul> <li><span style="font-size: 13px;">The strrpos() function <strong>finds the position</strong> of the <stro

View More

how to get length from string in php

<h2>* PHP strlen() Function :-</h2> <ul> <li><span style="font-size: 13px;">The <strong>strlen() function</strong> returns the <strong>length of a string.</strong></span></li> </ul> <h2>Syntax :<

View More

how to compare string in php

<h2>* PHP strncmp() Function :-</h2> <ul> <li><span style="font-size: 13px;">The strncmp() function <strong>compares two strings.</strong></span></li> <li><b style="font-size: 13px;">Note:</b><sp

View More

how to Reverse a string in php

<h2>* PHP strrev() Function :-</h2> <ul> <li><span style="font-size: 13px;">The strrev() function reverses a string.</span></li> </ul> <h2>Syntax :</h2> strrev(<em>string</em>) <h2><strong>Exam

View More

how to Convert the first character from string in php

<h2>* PHP ucfirst() Function :-</h2> <ul> <li><strong><span style="font-size: 13px;">The ucfirst() function converts the first character of a string to uppercase.</span></strong></li> </ul> &nbsp

View More


    Latest posts

    17.04.14
    how to Convert the first character from string in php

    <h2>* PHP ucfirst() Function :-</h2> <ul> <li><

    17.04.14
    how to Reverse a string in php

    <h2>* PHP strrev() Function :-</h2> <ul> <li><s

    17.04.14
    how to compare string in php

    <h2>* PHP strncmp() Function :-</h2> <ul> <li><

    Get Free Quote