I'm rewriting a PHP plugin, and there are functions called $expode_top[]
& $expode_bottom[]
. I understand what the normal explode function does, but what are these?
It seems to be impossible to find an answer on Google because it replaces the underscore with a space.
Those are array variables, not functions, they just happen to start with a keyword you are familiar with. Anything beginning with a $
is a variable in PHP.
Using []
will put the assigned variable into the "next" position of the array. For example:
$expode_top = array();
$expode_top[] = "testing";
if ( $expode_top[0] == "testing" ){
echo "it does equal testing";
}
As @gwillie rightly commented, it could also be a variable function - the name of the variable is replaced and then that function is executed. Second example:
$expode_top = "echo";
$expode_top("testing");
Is functionally the same as:
echo("testing");
Those are array variable names, not functions, as indicated by the $ and []. Also, neither exists as a function.