Declaring) PHP Variables In PHP, a variable is declared using a $ sign followed by the variable name. We don’t need to declare the data types of variable, that’s why it called loosely typed language. Here we use Assignment Operator (=) to assign the value to a variable. Rules for PHP variables: A variable starts with the $ sign,… Continue reading PHP Variables
Category: PHP
PHP echo and print Statements
PHP echo and print PHP echo and print are more or less the same. Because they are both used to output data to the screen. echo has no return value while print has a return value of 1 so it can be used in expressions. echo can take multiple parameters while print can take one argument. echo is faster than print.
PHP Syntax
A PHP file contains HTML tags and some PHP scripting code. It is very easy to create a simple PHP example. To do so, create a file and write HTML tags + PHP code and save this file with .php extension. A PHP script starts with <?php And ends with ?> Note: PHP statements ends with… Continue reading PHP Syntax
How to Install PHP
To install PHP, we will give you suggestion to install AMP (Apache, MySQL, PHP) software stack. That is available for all operating systems. There are many AMP options available in the market that are given here WAMP for Windows LAMP for Linux MAMP for Mac XAMPP (Cross, Apache, MySQL, PHP, Perl) for Cross Platform: It includes some other components… Continue reading How to Install PHP
PHP Introduction
What is PHP PHP is a server-side scripting language, and a powerful tool for making dynamic and interactive Web pages or Websites. PHP is a widely-used, free, and efficient Programing Language. It is faster than other scripting languages, for example, ASP and JSP. It is stand for “PHP: Hypertext Preprocessor” Its scripts are executed on… Continue reading PHP Introduction
Difference Between $var and $$var in PHP
PHP $$var uses the value of the variable whose name is the value of $var. It means $$var is known as reference variable where as $var is normal variable.
PHP Superglobal – $GLOBALS
PHP $GLOBALS $GLOBALS is a PHP very worldwide variable which is utilized to get to worldwide factors from anyplace in the PHP content (additionally from inside capacities or strategies). PHP stores every worldwide variable in a cluster called $GLOBALS[index]. The file holds the name of the variable. Example #1 Using global Example #2 Using $GLOBALS… Continue reading PHP Superglobal – $GLOBALS
What is Superglobals variable in php ?
Some predefined variables in PHP are “superglobals”, which means that they are always accessible, regardless of scope – and you can access them from any function, class or file without having to do anything special. Superglobal variables are: $GLOBALS $_SERVER $_GET $_POST $_FILES $_COOKIE $_SESSION $_REQUEST $_ENV *We will explain in detail about these superglobal… Continue reading What is Superglobals variable in php ?
Difference Between For loop and Foreach loop in PHP
Foreach Loop:- 1> Foreach loop used when you have an array, without array it’s not worked. 2> Loop working at the end of array count. i.e. an array have 4 value then loop run 4 times. 3> Syntax is : $array = array(“C”,”C++”,”JAVA”,”PHP”); foreach($array as $language ){ … Continue reading Difference Between For loop and Foreach loop in PHP