TestingDocs.com
Software Testing website
  • Automation
    • Selenium
    • JBehave Framework
  • Tutorials
    • MySQL Tutorials
    • Testlink
    • Maven
    • Git
  • IDEs
    • IntelliJ IDEA
    • Eclipse
  • Flowcharts
    • Flowgorithm
    • Raptor
  • About

PHP

PHP Variables

Overview

PHP Variables are used to store values. We can use variables in PHP program so that we can use or manipulate later in the program. PHP is a loosely typed scripting language which means that we do not have to tell which data type the variable will hold.

Syntax

In PHP language, a variable starts with a dollar ($) sign.

$php_variable_name = value;

php_variable_name is name of the variable which holds the value. We use an assignment operator to store the value in the variable.

Naming Rules

Some variable naming rules are as follows:

A variable name can start with a letter or an underscore “_”
A variable name should not contain whitespaces.
A variable name can be comprised of alpha-numeric characters and underscores. (a-z, A-Z, 0-9, or _)

 

PHP Variables Demo

The IDE editor will prompt with PHP Platform variables when we type $ sign in the program. We can pick the required variables name automatically without the need of typing the whole variable name.

Example

In the following statement, we will assign a value of “79” to the variable named as “number”.

$number = 79;

Note that: Variable names are case-sensitive in PHP language. $NUMBER and $number are two different variables in PHP.

—

PHP Tutorials

PHP Tutorials on this website:

https://www.testingdocs.com/php-tutorials/

More Information on PHP

https://www.php.net/

Related Posts

Compoer Command line command

PHP /

Install Slim Framework on Windows

php download website

PHP /

Download and Install PHP on Windows

Composer Install Windows

PHP /

Composer Download on Windows

Apache conf file

PHP /

PHP 7 Configuration in Apache Server

phpMyAdmin Tool UI

PHP /

phpMyAdmin Database Tool

‹ PHP Comments› PHP String Variables

Recent Posts

  • Install RAPTOR Avalonia on CentOS
  • Download RAPTOR Avalonia Edition on Windows
  • npm doctor command
  • RAPTOR Editions
  • Flowgorithm Conditional Breakpoint Statement
  • Flowgorithm Read Numbers from File Example
  • Search Text File Flowchart Example
  • Flowgorithm Turtle Graphics Symbols
  • Draw Circle using Flowgorithm Turtle
  • Draw Parallel Lines using Flowgorithm Graphics

Back to Top

Links

  • Contact
  • Privacy Policy
  • Cookie Policy

www.TestingDocs.com

Go to mobile version