hello friends,
What is the differnece between $name and $$name?
Well, $name is a variable while $$name is a reference variable.
Check also PHP documentation for more information: http://www.php.net/manual/en/language.variables.variable.php
$name is a variable while $$name is a reference variable.
If we define variable in Php, we use $ sign for variable.
as per the question what is difference between $ & $$. According my view single $ is a normal variable while $$ variable takes the value of a variable and treats that as name of a variable.
$fruit = 'apple';
$$fruit = 'red';
echo $fruit . ' is ' . $apple; // returns 'apple is red'
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.