1
0
mirror of https://github.com/restoreddev/phpapprentice.git synced 2025-08-01 12:30:57 +02:00

Initial commit for public repo

This commit is contained in:
Andrew Davis
2018-09-02 10:57:36 -05:00
commit cb5d7c2386
79 changed files with 14644 additions and 0 deletions

25
code/basics.php Normal file
View File

@@ -0,0 +1,25 @@
<?php
// In the tradition of our ancestors, let's start with a hello world program.
// All PHP files must start with a <?php tag unless it is for a html template.
// (We will learn about html templates later.)
echo "Hello World!\n";
// There is a lot going on in this statement so let's work through it.
// First, the echo keyword tells PHP to output some text.
echo 'I am some text';
// Second, PHP stores text in strings.
// To write a string, you surround letters with single or double quotes.
// The difference between single quoted strings and double quoted strings
// is that double quoted strings can hold special characters like \n which tells PHP to start a new line.
'I am a string';
"\nI am a string on a new line";
// Third, all lines of code in PHP must end in a semi-colon.
echo "No semi-colon is a no-no\n";
// Using semi-colons means we can write multiple statements on one line.
echo 'Hello'; echo " World\n";