oprava gramatiky

This commit is contained in:
kankys 2024-09-08 12:45:11 +02:00
parent ee6399e970
commit b453b6766e
7 changed files with 176 additions and 3 deletions

5
.buildpath Normal file
View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
<buildpathentry kind="src" path=""/>
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
</buildpath>

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/nbproject/private/

22
.project Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>PHP_DS_Project</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.dltk.core.scriptbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.php.core.PHPNature</nature>
</natures>
</projectDescription>

View File

@ -1,7 +1,8 @@
<?php
<?php
// Cyklus foreach - na práci s polem
// Cyklus for
$school = "Bradavice";
echo("něco $school");
?>

View File

@ -0,0 +1,7 @@
include.path=${php.global.include.path}
php.version=PHP_83
source.encoding=UTF-8
src.dir=.
tags.asp=false
tags.short=false
web.root=.

9
nbproject/project.xml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>DS_PhpProject</name>
</data>
</configuration>
</project>

128
odkladiste.php Normal file
View File

@ -0,0 +1,128 @@
<?php
// Přepisování proměnných (statické a dynamické typování)
$name = "Lukáš";
$adult = true;
echo $name;
echo "<br>";
// Pravda, nepravda = true, false
$kolej = false;
$adult = false;
$is_logged = true;
$database_connection = false;
echo "Přihlášení uživatele: $is_logged";
echo "<br>";
echo "Napojení do databáze: $database_connection";
// Null
$kolej = null;
echo $kolej;
$kolej = "Nebelvír";
echo $kolej;
// Matematické operace
$students_2022 = 100;
$students_2023 = 124;
$results = $students_2022 - $students_2023 * 5;
$results2 = $students_2022 + $students_2023;
$results3 = $students_2022 * $students_2023 ;
$results4 = $students_2022 / $students_2023;
echo "Výsledek: $results";
echo "<br>";
echo "Výsledek: $results2";
echo "<br>";
echo "Výsledek: $results3";
echo "<br>";
echo "Výsledek: $results4";
// Spojování proměnných
$first_name = "Harry";
$second_name = "Potter";
$friend_first_name = "Ron";
echo $first_name . " " . $second_name;
echo "<br>";
echo $first_name. " a " .$friend_first_name;
// Type conversion
$year_price = "1500";
$year_caunt = "7";
$results_price = $year_price * $year_caunt;
echo $results_price;
echo "<br>";
var_dump($results_price);
echo "<br>";
var_dump($year_caunt);
// Negace
$database_connection1 = true;
var_dump(!$database_connection1);
// Pole (array)
$students = ["Harry", "Ron", "Hermiona"];
$students2 = [1 => "Harry", 65 => "Ron", "Hermiona"];
echo $students[1];
echo "<br>";
var_dump($students);
echo "<br>";
var_dump($students2);
// Asociatvní pole
$students3 = [
"first_name" => "Harry",
"second_name" => "Potter",
"college" => "Nebelvír",
"age" => 15
];
echo $students3["second_name"];
// Dvoudimenzionální pole (pole v poli)
$students4 = [
[
"first_name" => "Harry",
"second_name" => "Potter",
"age" => 15
],
["first_name" => "Hermiona",
"second_name" => "Grangerová",
"age" => 14
],
["first_name" => "Ron",
"second_name" => "Weasly",
"age" => 15],
];
var_dump($students4);
echo "<br>";
echo $students4[0]["first_name"];
echo "<br>";
echo $students4[2]["second_name"];
// Foreach cyklus
$students5 = ["Harry", "Ron", "Hermiona", "Malfoy"];
foreach ($students5 as $index => $one_student5) {
$index++;
echo $index.". " . $one_student5;
echo "<br>";
// Foreach cyklus
$students6 = [
"jmeno" => "Harry",
"prijmeni" => "Potter",
"kolej" => "Nebelvír",
"vek" => 15
];
foreach ($students6 as $index1 => $one_information) {
echo $index1.": ".$one_information;
echo "<br>";
};
}