Including files in PHP

Including files in PHP In PHP you can include one PHP file into another and can execute them on the server. For including files in PHP we can use following PHP functions: include() include_once() require() require_once() Let’s see above function in details To learn including files in PHP, let’s say there is a scenario where … Read more

HTTP header in PHP

HTTP Header: In the web application the communication you do with server are mainly through browsers. And browser in actual communicates with server using HTTP header. When you send a request for any web page to the server, a server returns the page along with some more information which is an HTTP header. This information contains the … Read more

Arrays in PHP

Arrays in PHP Definition: Arrays in PHP are the special type of variable which can store similar type of data/ values inside a single variable. An array is one of the basic data structures. We can access each array variable using a key known as an index of the array. An array index can be … Read more

PHP Strings

PHP Strings Definition: PHP Strings are defined as the sequence of characters with a certain length. Example: “This is PHP Strings tutorial by codingkala.com”. Creating string variable: $str 1 = “This is strings in PHP tutorial”; $str2 = “123456”; //Numbers present inside double quotes will become strings of numbers. $str3 = ‘codingkala.com contains PHP and other programming … Read more

PHP Superglobal Variables

  PHP Superglobal Variables   In PHP web application all the data which includes HTTP request are automatically handled by certain variables. These are PHP Superglobal Variables. These variables collect the information automatically when any HTTP request occurs. The list of widely used PHP superglobal variables arrays are:   1. $_GET: $_GET collects all the … Read more

Scope of variables in PHP

Scope of variables in PHP is termed as the access level of a variable within the code. There are four types of scopes present in PHP for variables.   Local variable Global variable Static variable Function parameters Local Variables: Lets see local variable first in a function. function num1() { $num1 = 100; echo “Number -“.$num1; … Read more

PHP Functions

  What is a Function: PHP Functions are separate blocks of code which can be executed when gets called. A function can also accept optional parameters and after execution can return values to the caller. Let’s see PHP Functions in details. Syntax: <?php function showName($first_name, $last_name) { echo “This is full name – ” . $first_name … Read more

PHP Programming Loops

If you want to execute few lines of codes for a specific number of times repeatedly, then we will use PHP Programming Loops. We are having PHP Programming Loops types: while do…while for foreach There are two statements which are used in loops those are “continue” and “break“. 1. while loop: The first type in … Read more

PHP decision making statements

As the name suggests, PHP decision-making statements are used to make decisions in programming. We can also say when there is a situation where certain conditions occur in our program when a program has to take a decision to choose any specific option, then we use decision-making statements or “conditional logic“. We have three PHP … Read more