Po lekci 37 -> pokračovat 38

This commit is contained in:
kankys 2024-09-08 15:14:37 +02:00
parent b453b6766e
commit 1494ee75b9
7 changed files with 145 additions and 4 deletions

View File

@ -1,8 +1,19 @@
<?php
// Cyklus foreach - na práci s polem
// Cyklus for
//Podmínky a empty
$articles = [];
var_dump(empty($articles));
echo "<br>";
if (empty($articles)) {
echo "Neexistují žádné články";
exit();
}
// VYpsání článků z databáze
echo "<br>";
echo 'Další kód na stránce';
?>
?>

View File

@ -124,5 +124,46 @@ foreach ($students5 as $index => $one_student5) {
foreach ($students6 as $index1 => $one_information) {
echo $index1.": ".$one_information;
echo "<br>";
};
}
}
// Cyklus foreach - na práci s polem
// Cyklus for
for ($i = 1; $i <= 30; $i++) {
echo $i. " .Harry";
echo '<br>';
}
// Cyklus foreach - na práci s polem
// Cyklus for - kolikrát se má cyklus provést
for($y = 1; $y <= 5; $y++) {
echo "<a href='./stranky/stranka$y.php'>Další stránka</a>";
echo "<br>";
};
// Cyklus foreach - na práci s polem
// Cyklus for - kolikrát se má cyklus provést
// Cyklus while - while cyklus znamená dokud - nevíme kolikrát (provádí se dokud platí podmínka)
$month = 1;
while ($month <=12){
echo $month;
echo "<br>";
$month = $month + 1;
}
$test_questions = ["1. otázka", "2. otázka", "3. otázka", "4. otázka", "5. otázka"];
$maximum = 2;
$counter = 0;
while($counter < $maximum) {
echo $test_questions[$counter];
echo "<br>";
$counter++;
};
// Podmínky
if (5 > 20) {
echo "Ano, je to pravda";
} else {
echo "Není to pravda";
}

17
stranky/stranka1.php Normal file
View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/EmptyPHPWebPage.php to edit this template
-->
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<h1>Nová stránka 1</h1>
<?php
// put your code here
?>
</body>
</html>

18
stranky/stranka2.php Normal file
View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/EmptyPHPWebPage.php to edit this template
-->
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<h1>Nová stránka 2</h1>
<?php
// put your code here
?>
</body>
</html>

18
stranky/stranka3.php Normal file
View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/EmptyPHPWebPage.php to edit this template
-->
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<h1>Nová stránka 3</h1>
<?php
// put your code here
?>
</body>
</html>

18
stranky/stranka4.php Normal file
View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/EmptyPHPWebPage.php to edit this template
-->
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<h1>Nová stránka 4</h1>
<?php
// put your code here
?>
</body>
</html>

18
stranky/stranka5.php Normal file
View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/EmptyPHPWebPage.php to edit this template
-->
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<h1>Nová stránka 5</h1>
<?php
// put your code here
?>
</body>
</html>