Skip to content
Open
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
31 changes: 13 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,41 @@
<img alt="Version" src="https://img.shields.io/badge/version-1.0-blue.svg?cacheSeconds=2592000" />
</p>

> In this project you will learn the basic notions of the famous PHP language which is so used in the world of web development.
> This project shows some guidelines of basics concepts of PHP.
>
> 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 <!-- omit in toc -->

- [Requirements](#requirements)
- [Repository](#repository)
- [Technologies used](#technologies-used)
- [Organization](#organization)
- [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.

<img src="https://docs.github.com/assets/cb-23088/images/help/repository/fork_button.png" alt="Fork on GitHub" width='450'>
- Understand how to use Xampp
- Improve GitHub

## Technologies used

\* PHP

## Project delivery
## Organization

- Understand pill
- Install Xampp
- Create differents blanks of content
- Write README
- Do de pull request.

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)
- [PHP Tutorials](https://www.w3schools.com/php/)
- [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)

53 changes: 53 additions & 0 deletions arrays.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

#SIMPLE ARRAY STRING

$fruits = ["mango", "kiwi", "apple"];
var_dump($fruits);
echo "<br><br>";

#SIMPLE ARRAY NUMBERS

$numbers = [1,2,3,4,5];
var_dump($numbers);
echo "<br><br>";



#MULTIDIMENSIONAL ARRAY

$multiArr = [[1, 2], [2, 3], [4, 5]];
var_dump ($multiArr);
echo "<br><br>";

#LENGTH ARRAY

$length = count($multiArr);
var_dump($length);
echo "<br><br>";

#COMBINATION ARRAYS

$combi = array_merge($numbers, $fruits);
var_dump($combi);
echo "<br><br>";


#RETURN LAST NUMBER

$lastN = end($numbers);
var_dump($lastN);
echo "<br><br>";



#ADD NEW ELEMENT

$newE = array_push($fruits, "orange");
var_dump($newE);
echo "<br><br>";




?>
76 changes: 76 additions & 0 deletions conditionals.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php

#CONDITION

$date = new DateTime();


#CURRENT DAY

$currentDay = $date->format('D');

if ($currentDay == 'Mon') {
echo "We are on Monday";
}

echo '<br><br>';

#CURRENT MONTH

$currentMonth = $date->format('M');

if ($currentMonth == 'Oct') {
echo "We are in October";
} else {
echo "We are in $currentMonth";
}

echo '<br><br>';



#CURRENT MINUTE

$currentMinute = $date->format('i');

if ($currentMinute < 10) {
echo "The current minute is less than 10";
} else if ($currentMinute > 15) {
echo "The current minute is more than 15";
} else {
echo "Does not meet any conditions";
}
echo '<br><br>';

#SWITCH

switch ($currentDay) {
case 'Mon':
echo "Start the week of classes";
break;

case 'Tue':
echo "Second day of classes";
break;

case 'Wen':
echo "Third day of classes";
break;

case 'Thu':
echo "Fourth day of classes";
break;

case 'Wen':
echo "Last day of classes";
break;

default:
echo "Is weekend";
break;
}




?>
31 changes: 31 additions & 0 deletions dates.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

#DATETIME Y-M-D

$date = new DateTime;

echo $date->format ('Y-m-d');

echo '<br><br>';

#CURRENT DAY ANY FORMAT

echo $date->format ('Y-m-d H:i:s');
echo '<br><br>';

#CURRENT DAY

echo $date->format ('D-d');
echo '<br><br>';

#CURRENT MONTH

echo $date->format ('m');
echo '<br><br>';

#CURRENT MINUTE

echo $date->format ('i');


?>
58 changes: 58 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

#FUNCTION SUM

function sum($x, $y) {
return $x + $y;
}

echo sum(2,4);
echo "<br><br>";

#FUNCTION MULTIPLICATION

function multiply($x, $y) {
return $x * $y;
}
echo multiply(2, 4);
echo "<br><br>";


#FUNCTION DIVISION

function division($x, $y) {
return $x / $y;
}
echo division(4, 2);
echo "<br><br>";



#OPERATION

function operation($x, $y, $op)
{
switch ($op) {
case "+":
return sum($x, $y);
break;
case "*":
return multiply($x, $y);
break;
case "/":
return division($x, $y);
break;
default:
return "Error";
break;
}
}

echo operation(4, 2, "/");
echo "<br><br>";





?>
48 changes: 48 additions & 0 deletions iterators.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php


#FOR

for($i = 0; $i <= 5; $i++){

echo $i;
}

echo "<br><br>";

#FOREACH

$a = [1, 2, 3, 17];

foreach ($a as $v) {
echo $v;
}


echo "<br><br>";
#WHILE

$number = 1;

while($number < 10) {

echo $number;
$number++;

}


echo "<br><br>";

#DO WHILE


$n = 1;
do {
echo $n;
$n++;

} while ($n <= 5);


?>
37 changes: 37 additions & 0 deletions math.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php


$x = -4.24;

echo "<br><br>";

#ABSOLUTE

var_dump(abs($x));
echo "<br><br>";

#ROUNDED

var_dump(round($x));
echo "<br><br>";


#HIGHEST VALUE

echo(max(0, 150, 30, 20, -8, -200));
echo "<br><br>";

#LOWEST VALUE

echo(min(0, 150, 30, 20, -8, -200));
echo "<br><br>";

#RANDOM NUMBER

echo(rand());
echo "<br><br>";




?>
Loading