PHP Constants Example

Like other programming languages, PHP allows defining constants using the define() function. Once a constant is defined, we can not change or revert it. We should store a value as a constant which is never ever needed to be changed. For…

php loops tutorial

Loops are used to run the same lines of code for multiple times. If we want to execute same code multiple times then we can put it into a loop block to avoid code repetition. Loop structure includes three sections. These are,…

php include vs require

In this tutorial, we are going to see the list of functions used in PHP to include external file into a program. PHP provides various functions to include external files. It is required if the current code dependency is on the external…

PHP Print Statements Example

In PHP there are various methods to print data. PHP provides more functions and language constructs for printing various data types. These functions are varied on the data format printed on the browser using them. For example, the print()…

watermark in php example with code

Adding watermark in PHP is very simple. It can be done using PHP image libraries like GD. Using GD functions, we can use text or image as watermark onto a target layer/document. PHP / GD Text Watermarking Text watermarking functions are,…

php server variables examples

$_SERVER is one of the superglobal variables in PHP. It contains information about headers, server, host and etc. For that, it contains a huge list of information with appropriate global indices. With these global indices, the $_SERVER…

Data Types in PHP

This is one boring topic we have in all programming languages – list of data types. It is so boring that no one cares to read it once completely. Sometimes surprisingly developers discover that they have not used a particular data type.…

captcha code in php example with code

Before start working with user input by accessing HTML forms, we need to ensure that these inputs are entered manually by a human. Or else, people can submit bulk unwanted data through “cron” like program execution or any tools, which…

PHP OOP Access Modifiers

PHP access modifiers are used to set access rights with PHP classes and their members that are the functions and variables defined within the class scope. In PHP, there are some keywords representing these access modifiers. These keywords…

PHP function showing IP Address Example

This article covers the available ways to get IP address using PHP script. The ip address is the unique address for the machines like a client, server or proxy. In PHP, we can get an IP address in two ways. These are, By accessing the…