diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..66fff41 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "abusaidm.html-snippets" + ] +} \ No newline at end of file diff --git a/README.md b/README.md index b23c66e..4d952f1 100644 --- a/README.md +++ b/README.md @@ -49,3 +49,8 @@ To deliver this project you must follow the steps indicated in the document: - [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) + + + +Note: +All the comments are spanish/english just to save this code and use it in the future. diff --git a/Transaction.php b/Transaction.php new file mode 100644 index 0000000..66408d9 --- /dev/null +++ b/Transaction.php @@ -0,0 +1,51 @@ + amount = $amount; + $this-> description = $description; +} + +public function addTax(float $rate) +{ + $this->amount += $this->amount * $rate / 100; +} + + + + +public function applyDiscount(float $rate) +{ + $this->amount += $this->amount * $rate / 100; +} + +} + + + + Construction method or magic method y se escribe asi: __ + + +Definicion rapida : class comoSeLlame {var $propiedad y function method()}; +*/ + + + + + + +?> \ No newline at end of file diff --git a/arrays.php b/arrays.php new file mode 100644 index 0000000..92aaa06 --- /dev/null +++ b/arrays.php @@ -0,0 +1,117 @@ + 1, 4 => 1, 19, 3 => 13); +print_r($array); */ + + +/* Multidimensional array +$data = array( + array(1, 2, 3), + "John", + "Jane" + ); + + print_r($data); + +echo $data[0][1]; */ + + + + + +/* Lo que metemos dentro del corchete se llama index o key, pero si no se definen las keys, PhP lo hara automaticamente,empezando en 0, */ + +/* $progranmingLanguages = ['PHP', 'Java', 'Python']; + +$name = 'Gio'; + */ +/* echo $name[1]; + +echo $progranmingLanguages[0]; */ + + +/* Para ver si el item existe y envitar errores podemos usar por ejemplo: +la funcion isset . ideal para saber si existe*/ + +/* var_dump(isset($programingLanguages[0])); +var_dump(isset($programingLanguages[3])); */ + + +/* Y si queremos cambiar pro ejemplo 'Java' por C++? */ + + +/* $progranmingLanguages[1] = 'C++'; */ +/* echo $progranmingLanguages[1]; */ +/* var_dump($progranmingLanguages); +print_r($progranmingLanguages); */ + +/* la mejor manera de verlo seria asi: + echo '
';
+ */
+
+
+
+/*$progranmingLanguages = ['PHP', 'Java', 'Python'];
+
+$progranmingLanguages[] = 'C++'; /* Esta es la forma mas sencilla */
+/*array_push($progranmingLanguages, 'C++', 'C', 'GO'); /* Esta es mas complicada */
+/* estas son las dos formas de agreganrelementos al array como el push() de javascript
+ */
+
+
+
+/* array_pad() - Rellena un array a la longitud especificada con un valor
+list() - Asignar variables como si fueran un array
+count() - Cuenta todos los elementos de un array o algo de un objeto
+range() - Crear un array que contiene un rango de elementos
+foreach
+El tipo array
+
+https://www.php.net/manual/es/function.array.php
+https://www.youtube.com/watch?v=wLoPGWwMamc */
+?>
+
+
+
+
+
+ '8.0',
+ 'python' > '3.9'
+];
+
+
+
+/* echo '';
+
+echo $progranmingLanguages['php'];
+
+
+$programingLanguages['go'] = '1.15';
+
+echo $programingLanguages;
+
+
+
+https://www.youtube.com/watch?v=C8ZFLq24g_A
+https://www.php.net/manual/es/function.array.php */
+
+?>
\ No newline at end of file
diff --git a/conditionals.php b/conditionals.php
new file mode 100644
index 0000000..e79ef47
--- /dev/null
+++ b/conditionals.php
@@ -0,0 +1,79 @@
+ $Tuesday) {
+ echo "We are on Monday";
+ }
+
+
+$date1 = "10";
+$date2 = "05";
+
+if ($date1 > $date2)
+ echo "We are in October $date1";
+else
+ echo " We are in May $date2";
+ */
+
+
+
+
+/* elseif/else if */
+/* $a = 10;
+$b = 15;
+
+
+if ($a < $b) {
+ echo "The current minute is less than 10";
+} elseif ($a > $b) {
+ echo "The current minute is more than 15";
+} else {
+ echo "Does not meet any conditions";
+}
+
+
+Switch: */
+
+
+$x = 8;
+
+
+switch ($x) {
+ case 1:
+ echo "The answer is 1";
+ break;
+ case 2:
+ echo "This answer is 2";
+ break;
+ case 3:
+ echo "The answer is 3";
+ break;
+ case 4:
+ echo "The answer is 4";
+ break;
+ case 5:
+ echo "The answer is 5";
+ break;
+ default:
+ echo "There is no answer";
+}
+
+
+
+
+?>
diff --git a/dates.php b/dates.php
new file mode 100644
index 0000000..0d4dec2
--- /dev/null
+++ b/dates.php
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+ Document
+
+
+
+
+
+
+
+
+ ' ;
+
+/* echo $currentTime + 5 * 24 * 60 *60; los dias dentro de 5 dias, 5 dias, 24horas..etc */
+
+/* echo $currentTime - 60 * 60 * 24; el tiempo de ayer */
+
+/* Importante */
+echo date('m/d/Y g:ia ') . '
';
+
+/* la g nos da el formato 24h sin ceros, la i los minutos sin ceros y la a nos dice si es A.M o P.M */
+
+
+/* Otro ejemplo */
+echo date('m/d/Y g:ia ', $currentTime + 5 * 24 * 60 *60 ) . '
';
+
+/* Y para cambiar la franja horaria, seria algo asi: */
+date_default_timezone_set('UTC');
+
+echo date('m/d/Y g:ia ') . '
';
+
+
+echo date_default_timezone_get() . '
';
+
+
+/* Otra cosa importante para convertir 'parse dates' string representation en unidades de tiempo, ejemplo: */
+
+echo date('m/d/Y g:ia', mktime(0, 0, 0, 4, 10, null)) . '
';
+/* String to time function */
+echo strtotime('2021-01-18 07:00:00') . '
';
+
+/* Mola poder ponerle por ejemplo el tomorrow asi: */
+/* o 'las day of february' o 'second friday of January' etc */
+echo date('m/d/Y g:ia', strtotime('tomorrow'));
+
+
+?>
+
+
+
+
+
\ No newline at end of file
diff --git a/functions.php b/functions.php
new file mode 100644
index 0000000..b037a0e
--- /dev/null
+++ b/functions.php
@@ -0,0 +1,82 @@
+";
+echo "7 + 13 = " . sum(7, 13) . "
";
+echo "2 + 4 = " . sum(2, 4); */
+
+
+
+
+function add_five(&$value) {
+ $value += 5;
+ }
+
+ $num = 2;
+ add_five($num);
+ echo $num;
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+https://www.exakat.io/en/top-100-php-functions/
+https://www.youtube.com/watch?v=t9FrpTZm1ds
+https://www.php.net/manual/en/functions.internal.php
+https://www.php.net/manual/en/functions.user-defined.php
+https://www.youtube.com/watch?v=RIPJEgOrVRc
+
+https://www.php.net/manual/en/indexes.functions.php*/
+?>
\ No newline at end of file
diff --git a/game/img/1.png b/game/img/1.png
new file mode 100644
index 0000000..8ff7cec
Binary files /dev/null and b/game/img/1.png differ
diff --git a/game/img/BioShock_cover.jpg b/game/img/BioShock_cover.jpg
new file mode 100644
index 0000000..76bbe98
Binary files /dev/null and b/game/img/BioShock_cover.jpg differ
diff --git a/iterators.php b/iterators.php
new file mode 100644
index 0000000..444ad54
--- /dev/null
+++ b/iterators.php
@@ -0,0 +1,47 @@
+
+
+ */
+foreach (array(1, 2, 3, 4) as &$valor) {
+$valor = $valor * 2;
+}
+
+
+echo $valor;
+
+
+
+
+/* */
+
+
+$numero= 1;
+while ($numero <= 10)
+{
+echo $numero;
+$numero = $numero + 1;
+}
+
+
+
+
+/* */
+$numero= 1;
+
+do {
+echo $numero;
+$numero++; /* es lo mismo que $numero = $numero + 1; */
+} while ($numero <= 8);
+
+
+
+?>
\ No newline at end of file
diff --git a/maths.php b/maths.php
new file mode 100644
index 0000000..bc5554d
--- /dev/null
+++ b/maths.php
@@ -0,0 +1,37 @@
+";
+
+
+echo abs(3);
+echo "
";
+ */
+
+//round — Rounds a float
+
+
+/* $num1 = 10;
+$num2 = 2.54;
+
+
+echo round($num1/$num2);
+ */
+
+
+/* Max() and Min() Functions */
+
+/* $array =array(34,21,56,14,33); */
+
+//echo max($array);
+/* echo min($array); */
+
+/* echo rand(); */
+
+
+
+
+
+
+
+?>
\ No newline at end of file
diff --git a/operators.php b/operators.php
new file mode 100644
index 0000000..7555bed
--- /dev/null
+++ b/operators.php
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+ */
+$x = 5;
+$y = 10;
+
+if ($x == $y) {
+ echo "True!";
+}
+else {
+ echo "False!";
+}
+
+$x = 5;
+$y = 10;
+
+if ($x >= $y) {
+ echo "True!";
+}
+else {
+ echo "False!";
+}
+
+
+
+
+/* */
+
+
+
+$x = 10;
+$y = 20;
+
+if ($x == $y or 1 == 1) {
+ echo "True";
+}
+
+
+
+
+
+
+$x = 10;
+$y = 20;
+
+if ($x == $y and 1 == 1) {
+ echo "True";
+}
+
+
+$x = 10;
+$y = 20;
+
+if ($x == $y || 1 == 1) { /* es igual que Or */
+ echo "True";
+}
+
+
+
+$x = 10;
+$y = 20;
+
+if ($x == $y && 1 == 1) { /* este es igual que el and */
+ echo "True";
+}
+
+$x = 10;
+$y = 20;
+
+if ($x == $y xor 1 == 1) { /* este significa que solo 1 de las condiciones puede ser True */
+ echo "True";
+}
+
+
+?>
\ No newline at end of file
diff --git a/phpinfo.php b/phpinfo.php
new file mode 100644
index 0000000..b851967
--- /dev/null
+++ b/phpinfo.php
@@ -0,0 +1,15 @@
+
\ No newline at end of file
diff --git a/phpinfo/index.php b/phpinfo/index.php
new file mode 100644
index 0000000..6480abf
--- /dev/null
+++ b/phpinfo/index.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/print.php b/print.php
new file mode 100644
index 0000000..338c595
--- /dev/null
+++ b/print.php
@@ -0,0 +1,15 @@
+
+
+
+