I would like to dynamically create a array , I tried this way:
$zt = array(); $zt = ($p_p => $_p_p); print_r($zt);
$p_p is an array , where index 0 is the name, and index 1 is the value, 2 name, 3 value ..
$p_p is configured like this, but unfortunately it gives error in line
Parse error: syntax error, unexpected ‘= >’
If I do this:
$zt = ($p_p);
It does not give error, but the index is “0”, I needed it to be in fact the name, since I’m going to pass this array
POST as if they were fields of one form.
So I understand you want
$p_p to be the key and
$p_p o value, then:
$zt = array(); $zt[$p_p] = $p_p; print_r($zt);
If you want to create a simple (non-associative) array:
$zt = array(); $zt = $p_p => $_p_p;
If you want to create an associative array
$zt = array(); $zt[$p_p] = $p_p => $_p_p;
The difference is that one automatically assigns the index (numeric) and the second variant can have an index assigned (string).