PHP code example of faslatam / jsphp
1. Go to this page and download the library: Download faslatam/jsphp library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
faslatam / jsphp example snippets
ally, you're all set! You can now start using JSPHP in your projects.
$name = String('foo');
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
*/