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

    testing php linux

    PHP /

    Testing PHP with Apache Server on Linux

    ‹ PHP Comments› PHP String Variables

    Recent Posts

    • ChatGPT Plans Free and PlusChatGPT Subscription Plans
    • Stellar Converter for Database ToolStellar Converter for Database
    • Stellar MySQL Log AnalyzerStellar Log Analyzer for MySQL
    • Stellar Repair for MySQLStellar Repair for MySQL
    • ChatGPT IntroductionChatGPT Capabilities
    • How to secure your SQL Database: Tips and Tricks
    • ChatGPT4 Conversational AI FeaturesChatGPT4 Conversational AI Features
    • Trends in Software EngineeringShaping the Future of Development: Exploring Key Trends in Software Engineering
    • Java PerformanceImproving Java Performance with Multithreading
    • QDrant Vector DatabaseOpen-source Vector Databases
    • Difference between PHP and JavaScript?
    • Bing AI Browser Web ContentBing Conversation Styles
    • ChatGPT PreviewChatGPT Introduction
    • Open Source AI Frameworks TensorFlowOpen Source AI Frameworks
    • Artificial Intelligence Tools

    Back to Top

    Links

    • Contact
    • Privacy Policy
    • Cookie Policy

    www.TestingDocs.com