Trying to convert a perl script to php.
In perl I have a hash like this
my %SPEC=(
odmiles => ['OD Miles','Mileage','odmiles:ecmmiles','num'],
ecmmiles => ['ECM Miles',0,'','num',' ECM'],
cdl => ['CDL','CDL']);
I can access the data like so:
$SPEC{ecm}[3] # output = num
Since a hash in perl does not run in order I'll do a simple array
@ORD=('odmiles','ecmmiles','cdl');
then loop
foreach my $S (@ORD) {
print $S." = ".$SPEC{$S}[0]."<br />";
}
I can do similar with php but having issue accessing elements past [0] in my hash.
$SPEC = array("odmiles" => array("OD Miles", "Mileage", ...));Not sure if that is valid PHP.$SPEC{$S}[0]gives the first element, and you don't know that$SPEC{$S}[1]gives the second, and so forth?