Monday , 27 May 2019
Breaking News
Home > Tutorials > PHP


Convert comma separated values to array in PHP

Assalam-o-Alaikuim! Dear friends today we will learn about PHP arrays. We often need to select records from database. There are different methods to select data from Database. But today we will learn something difficult. Problem: Suppose you have following string data that you want to convert into an array to perform action on it: $string = “one,two,three,four”; and you need ... Read More »

How to Calculate Date of Birth in PHP

Assalam-o-Alaikum! Today we are going to learn that “How to Calculate Date of Birth in PHP”. I am giving simple code you should change values in code and see the result. Code is here: [crayon-5ceb2c4544d77596106498/] Now save this file and run it. Read More »

How to get MAC and IP address of Windows System with PHP

Assalam-o-Alaikum! Friends today I am going to that ‘How to get MAC address and IP address of Windows”. Trick is very simple, you have to run ‘ipconfig/all’ command through ‘System’ programme and then you will capture output and save into variable with ‘ob_get_contents()’ function. It will  return you an array and from this array you have to pull out your ... Read More »

How to Calculate Days, Months and Years in PHP

Assalam-o-Alaikum! Friends today I am going to tell you about an interesting function of PHP that will calculate date difference between two dates. You can find days, months and years between two dates. You can use this function where you need to count days for billing or for the expiration of user etc. For example, you want to calculate days between two ... Read More »

Better Way to Manage HTML Tags With PHP

There are many approaches to write your code in nice method but nowadays I am working on html function method to write my code. If your are developing a site which is based on Bootstrap, then I have a good trick for you. Let’s assume that you are using following lines for getting input: [crayon-5ceb2c4546255774806600/] And this structure is repeating ... Read More »

How to Print Calculation Table in Php


In today tutorial I will teach you that how to print table of given value. For example if the given number is 5 then table will look like this 5 x 1 = 5 5 x 2 = 10 and so on So lets start our tutorials. Look at below code [crayon-5ceb2c4546610530751347/] You can see the code is very very ... Read More »

Add or Subtract Days from Current Date in Php

T oday I am going to tech you that how to add or subtract days from current date in php. I often use this code for getting my required date. So let’s start. Look at below code:- [crayon-5ceb2c45477e9381521882/] Add you can see we used two functions date() and strtotime(), in date() function we have supplied format for date and in strtotime ... Read More »

How to Check Numeric Value in PHP


P hp provides very simple built-in function for checking where given value is numeric or not. I personally often check the value before entering it into database for exact data. Just copy below code and paste wherever you want and test it. [crayon-5ceb2c4549e37169513779/] Above code will check the value stored in variable and show us result. If the value is ... Read More »

Read and Write Text File with PHP

Read and Write with Php

This is very common tutorial but peoples who are new in PHP don’t know about PHP file handling functions. Writing on text file and reading back from text file is not difficult task Php provides very good functions for this purpose. I tried my best to make my code simple so let’s start. We will create two functions Write_on_file($file, $message) Read_from_file($file) ... Read More »

Ad Test