I was working on php script that requires translation in multi-language, So I found two ways to make it translation ready with PO and MO files. Here are the two methods to translate a php project using gettext PO/MO files.
- PHP core Gettext library
- PHP Gettext class (Mainly written for wordpress)
PHP core Gettext requires GNU gettext package to be installed on system. Whereas PHP gettext class doesn’t have any dependency. It can directly ready MO file and extract translation text from that. Also It works on windows server without problem. So in this article I will guide you how to use php-gettext class. Continue reading
In php creating zip file is very easy. PHP 5.2 has an inbuilt class ZipArchive to manipulate zip file, if you are using a older version of php then you can install PECL zip on your server. To make this task more handy I have created a simple function to make zip archive that anyone can use in their web application. Continue reading
PHP widely used for web development. More than 80% websites on internet are built using php. In this article i’ll tell you 10 most useful tips for php. Continue reading
It is a good idea to convert all urls into links in your web application like contact form, comment forms, chat application etc. To find and replace all urls with their links we will use php
preg_replace function. See below example
$text = "Hello Friends my website url is http://99webtools.com";
$text = preg_replace("~[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]~",'<a href="$0">$0</a>',$text);
Hello Friends my website url is http://99webtools.com
Calculation of difference between 2 dates is not an easy task so I m writing a function which do this job easily. This function is useful for calculate age of person by DOB (date of birth) or calculating age of record in databse Continue reading
To send email from your php script either you can use PHP’s built-in mail function or third party library like phpmailer or swiftmailer.
In this article you will find both methods to send email. Continue reading
Pure php based domain availability checker script. This script can check domain availability without whois lookup. And supports all TLDs over internet
How it works?
Each registered domain has its own ns (name server) entry. Which can be checked using dns_get_record() function. In this script we check whether queried domain has it ns entry or not if we found it then it is not available. Continue reading
Most of webmasters want to display weather information on their website. So I have decided to provide a tutorial to do this via PHP script.
There are tones of APIs that provides weather information like Yahoo weather, Open Weather Map, Accuweather, etc but my favourite is Open Weather Map. Lets start with OpenWeatherMap API. Continue reading
I was looking for php domain age checker script so I googled for it, but didn’t found any useful code. So I decided to write my own. It may be useful for webmasters. This script is based on our previous php whois script which extracts whois information from whois server. Continue reading
Webmaster often needs to generate random password for new users. There are many way to do this but I found a very simple method which can generate strong password of any length. This method is based on str_shuffle() function which randomly shuffles a string. Continue reading