Category: PHP

create PHP Rest API php

create PHP Rest API

Here is example of how create a rest API in PHP. Employee table Schema Create a ‘test’ MySQL database, if you have already any database then also run below sql into that database SQL query window. CREATE TABLE IF NOT EXISTS `employee` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT ‘primary key’, `employee_name` varchar(255) NOT NULL COMMENT ’employee […]

How to Submit Multiple Form array in Codeigniter using Ajax

In this article we will see how to implement multiple forms array with jQuery and JavaScript code asynchronously by Ajax. Now, when you simply submit your form the normal way, your browser takes care of sending HTML input arrays with ease and you can begin to segment your data on your server. Forms are largely […]

How to Work Cookie Management in Codeigniter

Cookies are small data files that store specific information about the sessions. This could login status and cart contents. CodeIgniter has one helper called “Cookie Helper” for cookie management. You may also like How to create flash messages in Codeigniter and How to Session Management in Codeigniter. Steps For How to Work Cookie Management in Codeigniter Step 1: […]

How to get Browser name, useragent, version, platform and pattern in PHP

I needed to get browser information with PHP and I wrote a function which uses the preg_match function with regular expressions to get information from the browser. This function (getBrowser()) will return information from browser in an array format including the browser name, browser userAgent, browser version, browser platform, and browser pattern. Example Output

How to rename file using PHP

To rename a file, you use the rename() function. This function also allows you to move a file to a different directory. For example, to rename the test.txt file to test.bak file, you use the following code. You may also like How to Copy file from one folder to another folder using PHP and How to get file […]

PHP natsort() Function

The natsort() function sorts an array by using a “natural order” algorithm. The values keep their original keys. This function implements a sort algorithm that orders alphanumeric strings in the way a human being would while maintaining key/value associations. Parameter Description array Required. Specifies the array to sort Syntax

PHP implode() Function

The implode() function returns a string from the elements of an array. The implode function is used to “join elements of an array with a string”. The implode function in PHP is easily remembered as “array to string“, which simply means that it takes an array and returns a string. Output Another Example Output