diff --git a/README.md b/README.md index 7c787c3..dd1db57 100644 --- a/README.md +++ b/README.md @@ -1,51 +1,5 @@ -`#php` `#basics` `#master-in-software-development` +# PHP Basics +_This is a project to learn few things we could do with PHP._ -# PHP Basics - -

- Version -

- -> In this project you will learn the basic notions of the famous PHP language which is so used in the world of web development. -> -> What distinguishes PHP from other languages ​​such as Javascript is that the code is executed on the server, generating HTML and sending it to the client. - -## Index - -- [Requirements](#requirements) -- [Repository](#repository) -- [Technologies used](#technologies-used) -- [Project delivery](#project-delivery) -- [Resources](#resources) - -## Requirements - -- Learn the basics to program in PHP -- Understand what a server-side language is and what it is used for - -## Repository - -First of all you must fork this project into your GitHub account. - -To create a fork on GitHub is as easy as clicking the “fork” button on the repository page. - -Fork on GitHub - -## Technologies used - -\* PHP - -## Project delivery - -To deliver this project you must send a Pull Request as explained in the Students Handbook. Remember that the PR title must be with the format -- Solution: + NAME AND SURNAME or TEAM NAMES AND SURNAMES. -- For example: "Solution: Josep Riera", "Solution: Josep Riera, Toni Suárez, Marta Vázquez" - -## Resources - -- [What can PHP do?](https://www.php.net/manual/es/intro-whatcando.php) -- [Sample guide for README](https://gist.github.com/Villanuevand/6386899f70346d4580c723232524d35a) -- [XAMPP](https://www.apachefriends.org/es/index.html) -- [How to install XAMPP on Windows](https://www.youtube.com/watch?v=h6DEDm7C37A) -- [What is a web server?](https://www.youtube.com/watch?v=Yt1nesKi5Ec) -- [Web server basics](https://www.youtube.com/watch?v=3VqfpVKvlxQ) +## Author +* **[Valentino Traverso](https://github.com/valentraverso)** - Developer diff --git a/arrays.php b/arrays.php new file mode 100644 index 0000000..688bdf3 --- /dev/null +++ b/arrays.php @@ -0,0 +1,22 @@ +format('D') === 'Mon'){ +print "We are on Monday"; +} + +echo '

'; + +// Show msg if its october +if($actualDate->format('M') === 'Oct'){ + print "We are in October"; +}else{ + print 'The actual month is '.$actualDate->format('M'); +} + +echo '

'; + +// Show msg if before 10 minutes and if after 15 minutes +if($actualDate->format('i') < 10){ + print "the current minute is less than 10"; +}else if($actualDate->format('i') > 15){ + print "the current minute is more than 15"; +}else{ + print "does not meet any conditions"; +} + +echo '

'; + +// Show the actual day with a msg +switch($actualDate->format('D')){ + case 'Mon': + print 'Today is Monday'; + break; + case 'Tue': + print 'Today is Tuesday'; + break; + case 'Wen': + print 'Today is Wednesday'; + break; + case 'Thu': + print 'Today is Thursday'; + break; + case 'Fri': + print 'Today is Friday'; + break; + case 'Sat': + print 'Today is Saturday'; + break; + case 'Sun': + print 'Today is Sunday'; + break; +} \ No newline at end of file diff --git a/dates.php b/dates.php new file mode 100644 index 0000000..72de49e --- /dev/null +++ b/dates.php @@ -0,0 +1,27 @@ +
'; + +// Display year month day +print $date->format('Y-m-d'); + +echo '

'; + +// Display day +print $date->format('d'); + +echo '

'; + +// Display month +print $date->format('m'); + +echo '

'; + +// Display minutes 0-59 +print $date->format('i'); \ No newline at end of file diff --git a/functions.php b/functions.php new file mode 100644 index 0000000..a87f017 --- /dev/null +++ b/functions.php @@ -0,0 +1,35 @@ +'; + +for($i = 0; $i < 10; $i++){ + print $i.' '; +} + +print '
Loop forEach
'; + +$forEach = array(1, 2, 3, 4); +forEach($forEach as $num){ + print_r($num.' '); +} + +print '
Loop While
'; + +$while = 1; +while($while <= 4){ + print $while.' '; + + $while++; +} + +print '
Loop Do While
'; + +$doWhile = 1; + +do{ + print_r($doWhile); + + $doWhile++; +}while($doWhile <= 0); + +?> \ No newline at end of file diff --git a/maths.php b/maths.php new file mode 100644 index 0000000..828c8da --- /dev/null +++ b/maths.php @@ -0,0 +1,39 @@ + \ No newline at end of file diff --git a/phpinfo.php b/phpinfo.php new file mode 100644 index 0000000..bfd863b --- /dev/null +++ b/phpinfo.php @@ -0,0 +1,2 @@ +
'; + +print 'Hello World!'; + +print '

'; + +print_r(var_dump(5)); + +?> \ No newline at end of file diff --git a/strings.php b/strings.php new file mode 100644 index 0000000..70653f5 --- /dev/null +++ b/strings.php @@ -0,0 +1,36 @@ +