Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion app/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use PhpSchool\LearnYouPhp\Exercise\TimeServer;
use PhpSchool\LearnYouPhp\Exercise\DependencyHeaven;
use PhpSchool\LearnYouPhp\TcpSocketFactory;
use PhpSchool\PhpWorkshop\Event\Event;
use Symfony\Component\Filesystem\Filesystem;
use Faker\Factory as FakerFactory;

Expand Down Expand Up @@ -51,5 +52,15 @@
}),
DependencyHeaven::class => factory(function (ContainerInterface $c) {
return new DependencyHeaven(FakerFactory::create('fr_FR'));
})
}),

'eventListeners' => [
'exercise.selected.hello-world' => [
function () {
if (!file_exists('hello-world.php')) {
touch('hello-world.php');
}
}
]
]
];
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"require" : {
"php" : ">=5.6",
"ext-pdo_sqlite": "*",
"php-school/php-workshop": "^0.5",
"php-school/php-workshop": "^1.2",
"hoa/socket": "^1.0",
"php-school/workshop-installer": "^0.1"
},
Expand Down
102 changes: 53 additions & 49 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 22 additions & 2 deletions exercises/hello-world/problem/problem.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,34 @@ To make a PHP program, create a new file with a `.php` extension and start writi
$ php program.php
```

You can write to the console like so:
You can write to the console from a PHP program with the following code:

```php
<?php
echo "text";
```

When you are done, you must run:
The first line tells the PHP to interpret the code following it. It is required before any PHP code is written. Read more here: [http://php.net/manual/en/language.basic-syntax.phptags.php]()
The second line is the instruction to print out some text.

Place the code in to a text file using your favourite text editor, some popular editors are listed below:

* Sublime Text: [https://www.sublimetext.com/]()
* Atom: [https://atom.io/]()

Switch back to the terminal and run your code again with the same command as above:

```sh
$ php program.php
```

You should see the word "text" printed out on the console.

Now you must adapt the code to pass the challenge presented. Remember the challenge was: Write a program that prints the text "Hello World" to the console (stdout).

We have created you a file named `hello-world.php` in your current working directory, feel free to use it!

When you have finished and saved the file you must run the following (substituting program.php to the name of the file you created which contains your code)

```sh
$ {appname} verify program.php
Expand Down