PHP
Variables

Variables

PHP Variables are just like a cup which can store water, tea, ice-cream. same in php we can store integer, string, character, decimal value in a variable without defining it’s data type.

<!doctype html>	
<html>
	<head>
			<title>
				PHP Variables
			</title>
	</head>
	<body>
		<?php
		//String Variable
		$Name="Qasim";
		
		//Numeric Variable
		$Marks=785;
		
		//Decimal Variable
		$Height=5.78;
		
		//Character Variable
		$Grade='A';
		?>
	</body>
</html>

PHP Variable Rules

  • A Variable Starts with $ sign
  • A Variable Starts with Letter or Underscore after the $ Sign
  • A Variable can’t start with Number or any other special charter except underscore
  • A Variable can contains Alphabets, Number and underscore from special characters like (A-Z, a-z, 0-9, and _)
  • Variable names are case sensitive so be carefull with this