PHP: Debug Backtrace with Example

This article shows how we can use the debug_backtrace() PHP function to generate a backtrace. This function returns an array of associative arrays. It includes the current function name, file name, class name, line number, etc. where the debug backtrace function was called. Syntax debug_backtrace(int $options = DEBUG_BACKTRACE_PROVIDE_OBJECT, int $limit = 0): array Parameters $options … Read more

Set up PHP Development Environment with Docker

This article shows how you can set up a PHP development environment using Docker. We will be installing PHP, MySQL & Nginx, and PHPMyAdmin in the docker containers. Here’s a basic introduction to docker and docker tools & terminologies: Introduction to Docker and its Tools & Terminologies. Pre-requisites Docker should be installed on your machine: … Read more

PHP: Scrap Web Page Content using Simple HTML DOM Parser

This article shows how you can scrap or fetch any webpage’s HTML content/data in PHP. We will use Simple HTML DOM Parser to scrap webpage content. You can download it from here: PHP Simple HTML DOM Parser – Sourceforge You need to download the HTML DOM Parser from sourceforge and include simple_html_dom_parser.php in your PHP … Read more

MailChimp API v3.0 – Add Store to List, Add Product to Store, Add Order to Campaign

This article shows how you can use MailChimp API v3.0 with PHP and CURL to add ecommerce data to your MailChimp campaign. When purchases happen in your shop then you can add your purchase order data to MailChimp to track purchases from your MailChimp Campaign. A MailChimp campaign is associated to any particular MailChimp list. … Read more

PHP: Get Timezone & Time Difference from Latitude & Longitude using Google Maps Time Zone API

This article shows how you can get TimeZone name and id in PHP from latitude and longitude value by using Google Maps Time Zone API. Note that: You need to put your API Key in the maps api url like this: https://maps.googleapis.com/maps/api/timezone/json?location=$latitude,$longitude&timestamp=$time&key=xxxxxxxxxxxxxxxxxxxxx You can get the API key from here: Get API Key Here is … Read more

PHP: Get Latitude/Longitude using Google Maps API

Here is a quick PHP code to fetch latitude and longitude of any given place using Google Maps API. CURL is used to fetch data from the API URL. $address = "Kathmandu, Nepal"; $url = "http://maps.google.com/maps/api/geocode/json?address=".urlencode($address); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $responseJson = curl_exec($ch); curl_close($ch); $response = json_decode($responseJson); if ($response->status == … Read more

PHP & MongoDB: Very Simple Add, Edit, Delete, View (CRUD) [Beginner Tutorial]

In this article, I will be presenting simple PHP & MongoDB code to add, edit, delete and view data. This kind of system is also referred to CRUD (Create, Read, Update, Delete). Here is a step-by-step guide on creating a CRUD system using PHP & MongoDB: I suppose, you have already installed MongoDB. If not, … Read more

PHP: Simple Pagination

This article shows how to create a simple pagination in PHP and MySQL. In the example code present in this article: – We will be fetching data from a MySQL database table. – We will be showing certain rows of data in first page and other rows will be displayed in next pages. – We … Read more

PHP MySQL: Simple CRUD (Add, Edit, Delete, View) using PDO

This article shows how to create a CRUD (Create, Read, Update, Delete) application in PHP & MySQL using PHP Data Objects (PDO). PDO is a PHP extension that provides an interface for accessing databases in PHP. PDO is portable and powerful. There are many good features of PDO. The best one is that it’s cross-database … Read more