PHP Web Development Tutorials

PHP Web Development Tutorials and Articles
  Title / Author Reverse Sort Order Replies
Here's the code to read ID3 tage from a MP3 file <?php //Reads ID3v1 from a MP3 file and displays it $mp3 = "1.mp3"; //MP3 file to be read
I was wondering whether i could read the size of a directory using PHP. So i thought of making something which could help me read the size of the directory ,no. of directories and the no. of files in the given diretory. The function "getDirectorySize" will ignore link/shorcuts to files/directory....
Many times it is required for us to calculate the time remaining and display it in a very understandable format like days,weeks,hours etc. Here is a function i wrote to do the same. //FUNCTION FOR TIME LEFT function time_left($integer) { $seconds=$integer; if...
I never recommend using " (double quotes) when programming with PHP. Always use ' (single quotes) unless you need the features of " (double quotes). You might think it's much easier to write code as: echo "Today is the $day of $month"; However, using single quotes forces variables to be...
How to show the no. of users online on your site using PHP & MySQL. Step1: Creating the database Create a new table called 'useronline', with 3 fields inside a table. The fields are timestamp, ip and file. Below is the SQL to create the table. CREATE TABLE useronline ( timestamp...
Title says it all but to reemphasize that below PHP code block validate an email address. Its always good to have a client side validation for faster user responses but backend check is also needed for user not having client side scripting on. <?php function emailsyntax_is_valid($email) { ...
Many times we require to format a number to output with thousand place comma separator, here is a function will help you do so. function numcomma ($value) { if(strpos($value,".")) { $decimalval = substr($value,strpos($value,".")+1); $value =...
Many times its required that we truncate a long string and add ellipsis to the end of the truncated string. Here's a function which does exactly that. function truncate( $varb, $num ) { $dnum = intval($num); if (strlen($varb)>$dnum) { $nvarb = substr($varb, 0,...
Introduction RSS is a family of web feed formats used to publish frequently updated content such as blog entries, news headlines or podcasts. An RSS document, which is called a "feed," "web feed," or "channel," contains either a summary of content from an associated web site or the full text....
Introduction Roman numerals are a great way to add a bit of class to a web page. They are often used in official titles, such as the XXXIV Pennsic War (34th). The rules for Roman numerals are straightforward and therefore lend themselves to being scripted. The basic rules of Roman numerals...
PDO or PHP Data Objects is a data abstraction layer, i.e. it provides uniform methods to access different types of databases, as a result switching between or moving to a different database system is relatively easier. So, in simple language the code to access a SQLite db will also work for MySQL...
How To Find Similar Sounding Words Let say a condition where we wanted a utility that finds a matches of words which sounds all same. For example, stupid/stpid/stuuupid/sstuuupiid would all have the same soundex code, S313, Soundex is a phonetic algorithm which computes a soundex value for each...
PHP being the most popular & easy to deploy language for web applications offers a large number for functions for sorting compared to other languages like Perl, Python, etc which hardly have a few basic functions which have to be extended by the programmer. PHP reduces coding time by providing...
Smarty is a templating engine for PHP, it's one of the most popular templating engine used by PHP developers. Using a templating engine helps businesses separate presentation logic & application logic. Templating, you can say is a way to separate the business logic from the presentation...
Memcached is a high-performance open-source caching solution, generally used to improve web application performance by avoiding round-trips to RDBMS, to know more about memcached read Faster Webapps With Memcached. In this article we'll discuss about installing and using memcached in PHP. A PHP...
PHP 4.0.2 onwards libcurl support was added in PHP, libcurl is a free client library initially written by Daniel Stenberg which allows us to communicate with servers using a variety of protocols like HTTP,HTTPS,FTP,SMTP,LDAP, etc. In this article we'll be looking at enabling libcurl support in...
System tools & monitoring programs are often required to monitor a directory or file(s) for changes, not just content changes, it may even be attribute changes like permissions, timestamps etc. Inotify is being used for quite some time in C programming to achieve the same. Here we will be...
EXIF stands for Exchangeable image file format is standard by which metadata is stored in image & sound file formats, these are sometimes added by digital camera / software / or manually added by a user. These standards metadata tags help people track / store info, for example Flickr shows the...
File Transfer Protocol or popularly known as FTP has been a de facto standard for transferring files for many years, can be used in many programs / utilities like backup programs, etc. PHP is being increasingly used in writing scripts for maintenance and other purposes and the FTP extensions...
Parsing HTML has always been a tough cookie even for seasoned programmers, but nowadays parsing HTML is extensively used for scraping websites, crawling, error detection websites, and many other useful purposes. In this article we'll be looking into parsing HTML using PHP, for this purpose I...