Reputation: 2646
I have found this command written in PHP, but I cannot understand what it does... I have seen an introduction to arrays for PHP, but still, I can't figure this out.
$from=1;
$A['from'] = $A[$from];
What is the programmer here doing? I mean, how he can assign $A[$from] somewhere, since $A[$from] has not get any values (array A is not used before). And what this command does?
Upvotes: 0
Views: 72
Reputation: 113
This code mean
You have variable form have value = 1 and you have array with key that's mean
$array['key']=1
that was example
with your code
$form = 1 // this is variable have value = 1 $A['form']=$a[$form] // give key form value of variable form it's mean
echo $A['form']; // it will show you 1 witch is value of variable $form .
Upvotes: 2