1 | <?php |
||
2 | require_once __DIR__ .'/../vendor/autoload.php'; |
||
3 | use Kristuff\Mishell\Console; |
||
4 | |||
5 | // temporary message |
||
6 | Console::log(' I am a temporary message... I will be erased :(', 'red'); |
||
7 | |||
8 | // wait for a while, so we see the animation |
||
9 | sleep(3); |
||
10 | |||
11 | for ($i=1 ; $i<=100 ; $i++) { |
||
12 | |||
13 | // progress message |
||
14 | Console::overwrite(' I am a progress text... ('.Console::text($i.'%', 'green') .' completed)'); |
||
15 | |||
16 | // wait for a while, so we see the animation |
||
17 | usleep(100000); |
||
18 | } |
||
19 | |||
20 | // Overwrite message again |
||
21 | Console::overwrite(' '.Console::text('Process complete.', 'white', 'green', 'underlined')); |
||
22 | |||
23 | // wait for a while, so we see the animation |
||
24 | usleep(2000000); |
||
25 | |||
26 | // Overwrite message again |
||
27 | Console::overwrite(' Oh wait, I forgot something...', 'red'); |
||
28 | |||
29 | // wait for a while, so we see the animation |
||
30 | usleep(2000000); |
||
31 | |||
32 | // Overwrite message again |
||
33 | Console::overwrite(' '.Console::text('StandWith', 'yellow', 'blue').Console::text('Ukraine', 'blue', 'yellow')); |
||
34 | |||
35 | // wait for a while, so we see the animation |
||
36 | usleep(2000000); |
||
37 | |||
38 | // Overwrite message again (last time). |
||
39 | Console::overwrite(' Process complete', 'green', 'bold'); |
||
40 | |||
41 | // new blank line |
||
42 | Console::log(); |
||
43 | |||
44 | ?> |
||
0 ignored issues
–
show
|
|||
45 |
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.
A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.