From 11e8bc60c92a64ed3c678992cb03efd87ca7c9e1 Mon Sep 17 00:00:00 2001 From: Valentino Traverso Date: Mon, 19 Dec 2022 17:01:36 +0100 Subject: [PATCH 1/3] work finished --- README.md | 54 ++++------------------------------------------ arrays.php | 22 +++++++++++++++++++ conditionals.php | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ dates.php | 27 +++++++++++++++++++++++ functions.php | 35 ++++++++++++++++++++++++++++++ iterators.php | 35 ++++++++++++++++++++++++++++++ maths.php | 39 +++++++++++++++++++++++++++++++++ operators.php | 12 +++++++++++ phpinfo.php | 2 ++ print.php | 15 +++++++++++++ strings.php | 36 +++++++++++++++++++++++++++++++ types.php | 19 ++++++++++++++++ 12 files changed, 302 insertions(+), 50 deletions(-) create mode 100644 arrays.php create mode 100644 conditionals.php create mode 100644 dates.php create mode 100644 functions.php create mode 100644 iterators.php create mode 100644 maths.php create mode 100644 operators.php create mode 100644 phpinfo.php create mode 100644 print.php create mode 100644 strings.php create mode 100644 types.php diff --git a/README.md b/README.md index 7c787c3..1aaa2db 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 \ No newline at end of file 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 @@ + Date: Mon, 19 Dec 2022 17:02:39 +0100 Subject: [PATCH 2/3] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1aaa2db..f75088e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -#PHP Basics +# PHP Basics _This is a project to learn few things we could do with PHP._ ## Author -* **Valentino Traverso**(https://github.com/valentraverso) - Developer \ No newline at end of file +* **Valentino Traverso(https://github.com/valentraverso)** - Developer From 5c46efe414788896361747cbc3a7ebf4a3457e4c Mon Sep 17 00:00:00 2001 From: Valentino Traverso <56070071+valentraverso@users.noreply.github.com> Date: Mon, 19 Dec 2022 17:05:00 +0100 Subject: [PATCH 3/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f75088e..dd1db57 100644 --- a/README.md +++ b/README.md @@ -2,4 +2,4 @@ _This is a project to learn few things we could do with PHP._ ## Author -* **Valentino Traverso(https://github.com/valentraverso)** - Developer +* **[Valentino Traverso](https://github.com/valentraverso)** - Developer