PHP

2 minutes read
What is PHP ? PHP stands for Hypertext Preprocessor and is a server-side language. PHP allows web developers to create dynamic content that interacts with databases. PHP is relatively new (compared to languages such as Perl (CGI) and Java) but is quickly becomming one of the most popular scripting languages on the internet. Learn PHP Code PHP is basically used for developing web based software applications. Writing PHP code on your computer is very easy. Declaring PHP Code PHP scripts are always...
4 minutes read
FPDF is a class to create PDF files with PHP, that is to say without using the PDFlib library. For those who are already familiar with FPDF, this post will show you how to output your PDF file using FPDF. There are 4 methods that you can use according to your own needs: Method 1: Saving the PDF to a file: $pdf->Output('yourfilename.pdf','F'); 1 $pdf->Output('yourfilename.pdf','F'); ...
20 minutes read
XML2Array is a class to convert XML file content to an associative array in PHP. It returns an array which can be used for data insertion into database. Its simply take string xml content as input and return array. Its very user when we are handling with xml files getting from SOAP and curl request. <?xml version="1.0" encoding="UTF-8"?> <Class> <Student> <Name>Ashish</title> <Sex>Male</Sex> <Age>...
8 minutes read
This post is about How to add and subtract dates from one another. For example, this simple code can calculate what the date will be 5 weeks before or after from any specific date like: 2016-01-06 (yyyy-mm-dd). Subtracting days from a date The following example will subtract 2 days from 2016-01-06. $Date = "2016-01-06"; $sub_newdate = date('Y-m-d', strtotime($Date. ' - 2 day'));   Adding days into a date $add_newdate = date('Y-m-d', strtot...
2 minutes read
If you want to strip line feeds, carriage returns, and tabs you can use: $string = preg_replace('/[\x00-\x1F\x80-\x9F]/u', '', $string); 1 $string = preg_replace('/[\x00-\x1F\x80-\x9F]/u', '', $string);   =>Note that you must use single quotes for the above two examples. If you want to strip everything except basic printable ASCII characters (all the example characters above will be s...
2 minutes read
Now easy Get the lat long coordinates from an address. Type the address which would include the name of the street,city/town, state and country name to get more accurate lat long value. Get Lat Long By Address: //Make Address $address = $address.",".$area.",".$city.",".$country; $preparedAddress = str_replace(' ','+',$address); //Google Api $geocode=file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$...
3 minutes read
Some times we need the visitor’s IP address for validation, security, spam prevention etc. Getting the Visitor’s IP address is very easy in PHP. We can get the Internet Protocol (IP) address of any visitor by using PHP. Get Clients IP address using PHP script The easy way to get the visitor’s IP address in php is : // Get the visitors ip address <?php echo $ipaddress = $_SERVER['REMOTE_ADDR']; ?> 1234 // Get the vis...