codegurukool.com · Free coding tutorials & online compiler

Home › PHP Tutorial › PHP variables

PHP variables

Store values in variables that start with $.

A variable starts with $ followed by a name. There is no type keyword: PHP picks the type from the value. Double-quoted strings insert variable values; single-quoted strings do not.

Example code

<?php
$name = "Ada";
$age = 36;
$age = $age + 1;
echo "$name is $age";
?>

Run this code in the online editor

← PHP install and syntaxPHP echo and print →