<?php
$value = 'b';
$checkbox_values = ['a' => 'Aaa', 'b' => 'Bbb', 'c' => 'Ccc'];
array_walk($checkbox_values, function(&$value, $key) use($value) {
var_dump($value);
$value = (int)(strval($key) === $value);
});
print_r($checkbox_values);
- Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- Fatal error: Cannot use lexical variable $value as a parameter name in /in/cgOC3 on line 6
Process exited with code 255. - Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33
- string(1) "b"
string(1) "b"
string(1) "b"
Array
(
[a] => 0
[b] => 1
[c] => 0
)
preferences:
297.18 ms | 402 KiB | 300 Q