bucket_list_friends - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of bucket_list_friends.php
- <?php
- $amountfriends = readline( 'Hoeveel vrienden zal ik om hun dromen vragen ? ' . PHP_EOL);
- if (is_numeric($amountfriends) === false) {
- exit($amountfriends . ”is geen getal” );
- }
- $friends = [];
- for ($i = 0; $i < $amountfriends; $i++) {
- $yourname = readline('Wat is jouw naam ? ' . PHP_EOL);
- $dreams = [];
- $dreams .= $yourname;
- $numberdreams = readline(“Hoeveel dromen ga je opgeven?” . PHP_EOL);
- if (is_numeric($numberdreams) === false) {
- exit($numberdreams . “is geen geldig getal”);
- }
- for ($j = 0; $j < $numberdreams; $j++) {
- $yourdream = readline(“Wat is je droom?” . PHP_EOL);
- foreach ($friends as $yourname);
- echo($yourname . ' heeft als droom: ' . $yourdream);
- echo(PHP_EOL);
- }