Incrementing Array Elements in PHP
You can also apply increment and decrement operations:
<?php
$arr = [1, 2, 3, 4];
$arr[0]++;
++$arr[1];
$arr[2]--;
--$arr[3];
var_dump($arr); // will output [2, 3, 2, 3]
?>
Given the following code:
<?php
$arr = ['a' => 1, 'b' => 2, 'c' => 3];
$arr['a']++;
$arr['a']++;
$arr['b']--;
$arr['c']--;
$arr['c']--;
var_dump($arr);
?>
Without running the code, explain what the
result of the var_dump
function will be.