variable declaration
Posted: Fri Sep 25, 2009 5:48 am
Code: Select all
//what is the difference between following lines of code
var $abc = 10;
//and
$abc = 10;
// var keyword is necessary or not to declare a variable?
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
//what is the difference between following lines of code
var $abc = 10;
//and
$abc = 10;
// var keyword is necessary or not to declare a variable?
Code: Select all
var $abc = 10;Code: Select all
<?php
var $abc = 10 ; // this is line 2
function test()
{
global $abc;
echo $abc;
}
test();
?>
//it showing following error
//Parse error: parse error in C:\xampp\htdocs\variableTest.php on line 2
// i am using php 5.2.29 version
Code: Select all
var $abc = 10;