Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$function() and $$variable

Tags:

php

What the heck is $function(); and $$variable for?

Have never heard of these before, and searching on google doesn't give anything useful (possible that my keywords aren't perfect).

via https://stackoverflow.com/questions/4891301/top-bad-practices-in-php/4891422#4891422

like image 275
tomsseisums Avatar asked Feb 03 '11 21:02

tomsseisums


2 Answers

$function() is a variable function and $$variable is a variable variable.

Those linked pages should give you plenty to go on, or at the very least some actual words to search with.

like image 190
salathe Avatar answered Oct 11 '22 09:10

salathe


$$variable can be quite useful. What it does:

$a = 1;
$b = "a";
echo $$b;

Outputs 1

like image 33
jeroen Avatar answered Oct 11 '22 08:10

jeroen