PHP variables
![]() | The CorenSearchBot has performed a web search with the contents of this page, and it appears to include material copied directly from:
It will soon be reviewed to determine if there are any copyright issues. The content should not be mirrored or otherwise reused until the issue has been resolved. If substantial content is duplicated, unless evidence is provided to the contrary (e.g. evidence of permission to use this content under terms consistent with the Wikimedia Terms of Use or public domain status; see Wikipedia:Donating copyrighted materials), editors will assume that this text is a copyright violation, and will soon delete the copy.
Before removing this notice, you should:
|
'<?php
$txt=”Hello World!”;
$x=16;
?>
PHP is a Loosely Typed Language
In PHP, a variable does not need to be declared before adding a value to it.
In the example above, you see that you do not have to tell PHP which data type the variable is.
PHP automatically converts the variable to the correct data type, depending on its value.
In a strongly typed programming language, like C,C++,Java etc you have to declare (define) the type and name of the variable before using it.
In PHP, the variable is declared automatically when you use it.