diff --git a/LEAME.md b/LEAME.md index e120094..d2be02c 100644 --- a/LEAME.md +++ b/LEAME.md @@ -45,6 +45,21 @@ echo $nombre->toUpperCase(); # Salida: FOO $usuario = JSON::parse('{ "id": 1, "nombre": "foo" }'); echo $usuario->nombre; # Salida: foo +$colores = JSArray(['rojo', 'púrpura', 'negro']); +$colores->forEach(function (?string $color): void { + echo "Me gusta el color $color\n"; +}); + +echo "\ncolores = $colores"; + +/* Output: +---------- +Me gusta el color rojo +Me gusta el color púrpura +Me gusta el color negro + +colores = rojo,púrpura,negro + */ ``` ## Componentes diff --git a/README.md b/README.md index 5ece2a1..8388ee7 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,21 @@ echo $name->toUpperCase(); # Output: FOO $user = JSON::parse('{ "id": 1, "name": "foo" }'); echo $user->name; # Output: foo +$colors = JSArray(['red', 'purple', 'black']); +$colors->forEach(function (?string $color): void { + echo "I like the color $color\n"; +}); + +echo "\ncolors = $colors"; + +/* Output: +---------- +I like the color red +I like the color purple +I like the color black + +colors = red,purple,black + */ ``` ## Components