To choose between PHP and Ruby, rate them on the comparison parameters by entering scores (+ve or -ve) in the comparison tool.
The total points are automatically shown in the top row. This should help you decide.
PHP's built-in array type is in reality an associative array. Even when using numerical indexes, PHP internally stores it as an associative array. This is why one in PHP can have non-consecutive numerically indexed arrays. The keys have to be scalar values (string, floating point number or integer), while values can be of arbitrary types, including other arrays and objects. The arrays are heterogeneous; a single array can have keys of different types. PHP's associative arrays can be used to represent trees, lists, stacks, queues and other common data structures not built into PHP.
In PHP, an associative array can be formed in one of two ways:
You can also loop through an associative array in PHP as follows:
foreach ($phonebook as $name => $number) {
echo "Number for $name: $number\n";
}
// For the last array example it is used like this
foreach($phonebook['contacts'] as $name => $num) {
echo "Name:{$name}";
echo "Number:{$num['number']}";
}