PHP Tutorials

How to Insert JSON Data into MySQL using PHP

How to Insert JSON Data into MySQL using PHP

In this tutorial I will show you How to Insert JSON Data into MySQL using PHP. To convert JSON to MySQL using PHP includes some steps like how to read JSON file, convert json to array and insert that json array into MySQL database. Here are the steps to Insert JSON data into MySQL using PHP. Step 1: Read the JSON file in PHP We have to read the JSON …

Continue reading

How to Convert XML into Associative Array in PHP

In this tutorial I will show you how to convert XML into associative array in php. I have found several methods and library to convert XML into array and following is a simple script to convert xml into array. I am using file_get_contents() php method to read xml file data into string. Steps to Convert XML into Associative Array Step 1: Following is a sample XML file books.xml Step 2: …

Continue reading

convert currency in PHP using Google Finance API

In this tutorial, I will show you how to convert currency in PHP using Google Finance API. Using the API you can easily convert any currency to your desired country currency. You have to send out http request to Google finance with three values – amount, from currency and to currency code. It sends back the response as HTML which you have to parse and extract the converted amount. PHP …

Continue reading

How to Parse HTML template in Codeigniter

How to Parse HTML template in Codeigniter

Sometimes we need to parse HTML data, for example to send an email with HTML template. In this tutorial I will explain how to parse HTML template in CodeIgniter. In CodeIgniter a Template Parser Class exists, which handle html template parsing process. The Template Parser Class parses pseudo and simple variables tag pairs contained within the view files. Pseudo-variable are enclosed in braces like below: So you need to add …

Continue reading

How to get YouTube subscribers count in php

How to get YouTube subscribers count in php

In this tutorial I will show you how to get YouTube subscribers count in php using api v3.0. We need just an API KEY to get work. Below I am sharing all the steps to get api key and get subscribers count. How to get YouTube API key Below are the steps to get YouTube API key 1. Go to https://console.developers.google.com/ and login to your google account. 2. Navigate to …

Continue reading

Enable image upload option in CKEditor using PHP

Enable image upload option in CKEditor using PHP

In this tutorial I will explain how to enable image upload option in CKEditor using PHP. To enable image upload option in CKEditor, follow steps as explained below. Integrate CKEditor Include following line in your view where you want to use ckeditor and place your ckeditor folder in root folder. Now add class ‘ckeditor’ to the textarea like below: Enable image upload option in ckeditor In ckeditor > config.js file …

Continue reading

Get current Indian time in PHP

In this tutorial I will show you to get current indian time in PHP using DateTimeZone and DateTime function. First get the DateTime object and set indian timezone to this DateTime object. Now format the output as in the following example.

Convert Uppercase to Lowercase without using PHP string functions

In this tutorial I will show you, how to Convert Uppercase to Lowercase, Lowercase to Uppercase without using PHP string functions. Let’s take a simple example of convert uppercase to lowercase and lowercase to uppercase. Explanation: ASCII values of lowercase characters(a-z) are from 97-122 and ASCII values of uppercase characters(A-Z) are from 65-90. ORD() function returns ASCII value of character. Difference between ASCII values of lowercase characters to uppercase character …

Continue reading