mirror of
https://github.com/janunger/rheinwerk-video-training.git
synced 2026-02-05 22:55:14 +01:00
Initiale Version
This commit is contained in:
13
Kapitel_2/Lektion_10/1_arrays_definieren.php
Normal file
13
Kapitel_2/Lektion_10/1_arrays_definieren.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
$liste = array(1, 2, 3);
|
||||
var_dump($liste);
|
||||
|
||||
$liste = [1, 2, 3];
|
||||
var_dump($liste);
|
||||
|
||||
$liste = ['a', 'b', 'xy'];
|
||||
var_dump($liste);
|
||||
|
||||
$liste = ['a', 'b', 'xy', 123, 1.23];
|
||||
var_dump($liste);
|
||||
4
Kapitel_2/Lektion_10/2_zugriff_auf_elemente.php
Normal file
4
Kapitel_2/Lektion_10/2_zugriff_auf_elemente.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$liste = ['a', 'b', 'xy', 123, 1.23];
|
||||
echo $liste[2];
|
||||
8
Kapitel_2/Lektion_10/3_assoziative_arrays.php
Normal file
8
Kapitel_2/Lektion_10/3_assoziative_arrays.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
$person = [
|
||||
'vorname' => 'Max',
|
||||
'nachname' => 'Muster'
|
||||
];
|
||||
$person['strasse'] = 'Musterstraße 1';
|
||||
var_dump($person);
|
||||
27
Kapitel_2/Lektion_10/4_foreach.php
Normal file
27
Kapitel_2/Lektion_10/4_foreach.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
$person = [
|
||||
'vorname' => 'Max',
|
||||
'nachname' => 'Muster',
|
||||
'strasse' => 'Musterstraße 1'
|
||||
];
|
||||
|
||||
|
||||
foreach ($person as $wert) {
|
||||
var_dump($wert);
|
||||
echo '<br>';
|
||||
}
|
||||
|
||||
|
||||
echo '<ul>';
|
||||
foreach ($person as $wert) {
|
||||
echo '<li>' . $wert . '</li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
|
||||
|
||||
echo '<ul>';
|
||||
foreach ($person as $schluessel => $wert) {
|
||||
echo '<li>' . $schluessel . ': ' . $wert . '</li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
22
Kapitel_2/Lektion_10/5_mehrdimensional.php
Normal file
22
Kapitel_2/Lektion_10/5_mehrdimensional.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
$personen = [
|
||||
[
|
||||
'vorname' => 'Max',
|
||||
'nachname' => 'Muster'
|
||||
],
|
||||
[
|
||||
'vorname' => 'Barbara',
|
||||
'nachname' => 'Beispiel'
|
||||
]
|
||||
];
|
||||
|
||||
foreach ($personen as $person) {
|
||||
var_dump($person);
|
||||
echo '<br>';
|
||||
}
|
||||
|
||||
foreach ($personen as $person) {
|
||||
var_dump($person['nachname']);
|
||||
echo '<br>';
|
||||
}
|
||||
14
Kapitel_2/Lektion_11/1_konstanten_definieren.php
Normal file
14
Kapitel_2/Lektion_11/1_konstanten_definieren.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
define('MEINE_KONSTANTE', 'Ein fester Wert');
|
||||
var_dump(MEINE_KONSTANTE);
|
||||
|
||||
|
||||
const ZWEITE_KONSTANTE = 'Ein weiterer Wert';
|
||||
var_dump(ZWEITE_KONSTANTE);
|
||||
|
||||
|
||||
const PROGRAMM = 'Hallo Welt';
|
||||
const VERSION = '1.0.0';
|
||||
|
||||
echo 'Programm ' . PROGRAMM . ' in Version ' . VERSION . '.';
|
||||
10
Kapitel_2/Lektion_12/1_POST.php
Normal file
10
Kapitel_2/Lektion_12/1_POST.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
var_dump($_POST);
|
||||
|
||||
?>
|
||||
<form action="" method="post">
|
||||
<input type="text" name="benutzername"/>
|
||||
<input type="password" name="password"/>
|
||||
<input type="submit"/>
|
||||
</form>
|
||||
11
Kapitel_2/Lektion_13/dateien_einbinden/seite1.php
Executable file
11
Kapitel_2/Lektion_13/dateien_einbinden/seite1.php
Executable file
@@ -0,0 +1,11 @@
|
||||
<h1>Meine Website</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="seite1.php">Seite 1</a></li>
|
||||
<li><a href="seite2.php">Seite 2</a></li>
|
||||
<li><a href="seite3.php">Seite 3</a></li>
|
||||
</ul>
|
||||
|
||||
<p>Hier stehen die Inhalte der ersten Seite.</p>
|
||||
|
||||
<p>© 2016 Rheinwerk-Verlag</p>
|
||||
11
Kapitel_2/Lektion_13/dateien_einbinden/seite2.php
Executable file
11
Kapitel_2/Lektion_13/dateien_einbinden/seite2.php
Executable file
@@ -0,0 +1,11 @@
|
||||
<h1>Meine Website</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="seite1.php">Seite 1</a></li>
|
||||
<li><a href="seite2.php">Seite 2</a></li>
|
||||
<li><a href="seite3.php">Seite 3</a></li>
|
||||
</ul>
|
||||
|
||||
<p>Dies ist die zweite Seite.</p>
|
||||
|
||||
<p>© 2016 Rheinwerk-Verlag</p>
|
||||
11
Kapitel_2/Lektion_13/dateien_einbinden/seite3.php
Executable file
11
Kapitel_2/Lektion_13/dateien_einbinden/seite3.php
Executable file
@@ -0,0 +1,11 @@
|
||||
<h1>Meine Website</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="seite1.php">Seite 1</a></li>
|
||||
<li><a href="seite2.php">Seite 2</a></li>
|
||||
<li><a href="seite3.php">Seite 3</a></li>
|
||||
</ul>
|
||||
|
||||
<p>Es gibt noch eine dritte Seite.</p>
|
||||
|
||||
<p>© 2016 Rheinwerk-Verlag</p>
|
||||
6
Kapitel_2/Lektion_13/dateien_einbinden_loesung/menu.php
Normal file
6
Kapitel_2/Lektion_13/dateien_einbinden_loesung/menu.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<ul>
|
||||
<li><a href="seite1.php">Seite 1</a></li>
|
||||
<li><a href="seite2.php">Seite 2</a></li>
|
||||
<li><a href="seite3.php">Seite 3</a></li>
|
||||
<li><a href="seite4.php">Seite 4</a></li>
|
||||
</ul>
|
||||
7
Kapitel_2/Lektion_13/dateien_einbinden_loesung/seite1.php
Executable file
7
Kapitel_2/Lektion_13/dateien_einbinden_loesung/seite1.php
Executable file
@@ -0,0 +1,7 @@
|
||||
<h1>Meine Website</h1>
|
||||
|
||||
<?php require 'menu.php'; ?>
|
||||
|
||||
<p>Hier stehen die Inhalte der ersten Seite.</p>
|
||||
|
||||
<p>© 2016 Rheinwerk-Verlag</p>
|
||||
7
Kapitel_2/Lektion_13/dateien_einbinden_loesung/seite2.php
Executable file
7
Kapitel_2/Lektion_13/dateien_einbinden_loesung/seite2.php
Executable file
@@ -0,0 +1,7 @@
|
||||
<h1>Meine Website</h1>
|
||||
|
||||
<?php require 'menu.php'; ?>
|
||||
|
||||
<p>Dies ist die zweite Seite.</p>
|
||||
|
||||
<p>© 2016 Rheinwerk-Verlag</p>
|
||||
7
Kapitel_2/Lektion_13/dateien_einbinden_loesung/seite3.php
Executable file
7
Kapitel_2/Lektion_13/dateien_einbinden_loesung/seite3.php
Executable file
@@ -0,0 +1,7 @@
|
||||
<h1>Meine Website</h1>
|
||||
|
||||
<?php require 'menu.php'; ?>
|
||||
|
||||
<p>Es gibt noch eine dritte Seite.</p>
|
||||
|
||||
<p>© 2016 Rheinwerk-Verlag</p>
|
||||
@@ -0,0 +1,7 @@
|
||||
<h1>Meine Website</h1>
|
||||
|
||||
<?php require 'menu.php'; ?>
|
||||
|
||||
<p>Es gibt noch eine vierte Seite.</p>
|
||||
|
||||
<p>© 2016 Rheinwerk-Verlag</p>
|
||||
1
Kapitel_2/Lektion_3/1_hallowelt.php
Normal file
1
Kapitel_2/Lektion_3/1_hallowelt.php
Normal file
@@ -0,0 +1 @@
|
||||
<?php echo "Hallo Welt!"; ?>
|
||||
21
Kapitel_2/Lektion_3/2_kommentare.php
Normal file
21
Kapitel_2/Lektion_3/2_kommentare.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
// Ein einzeiliger Kommentar
|
||||
|
||||
// Ausgabe des Textes "Hallo Welt"
|
||||
echo "Hallo Welt!";
|
||||
|
||||
// Die folgende Anweisung ist "auskommentiert".
|
||||
// echo "Hallo Welt!";
|
||||
|
||||
/*
|
||||
Mehrzeiliger
|
||||
Kommentar
|
||||
*/
|
||||
|
||||
/**
|
||||
* Mehrzeiliger Kommentar
|
||||
* im PHPDoc-Format
|
||||
*/
|
||||
|
||||
?>
|
||||
3
Kapitel_2/Lektion_4/1_kombination_html_und_php.php
Normal file
3
Kapitel_2/Lektion_4/1_kombination_html_und_php.php
Normal file
@@ -0,0 +1,3 @@
|
||||
<h1>Meine Website</h1>
|
||||
<p><?php echo "Hallo Welt!"; ?></p>
|
||||
<p>© <?php echo date("Y"); ?> Rheinwerk Verlag GmbH</p>
|
||||
4
Kapitel_2/Lektion_5/1_variablen_ausgeben.php
Normal file
4
Kapitel_2/Lektion_5/1_variablen_ausgeben.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$name = "Max Muster";
|
||||
echo $name;
|
||||
5
Kapitel_2/Lektion_5/2_variablen_mit_text_kombinieren.php
Normal file
5
Kapitel_2/Lektion_5/2_variablen_mit_text_kombinieren.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
echo "Hallo ";
|
||||
$name = "Max Muster";
|
||||
echo $name;
|
||||
11
Kapitel_2/Lektion_5/3_erlaubte_variablennamen.php
Normal file
11
Kapitel_2/Lektion_5/3_erlaubte_variablennamen.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
echo "Hallo ";
|
||||
$_name = "Max Muster";
|
||||
echo $_name;
|
||||
|
||||
echo "<br>";
|
||||
|
||||
echo "Hallo ";
|
||||
$Name = "Max Muster";
|
||||
echo $Name;
|
||||
12
Kapitel_2/Lektion_5/4_variablennamen_gross_klein.php
Normal file
12
Kapitel_2/Lektion_5/4_variablennamen_gross_klein.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
// Groß- und Kleinschreibung bei Variablennamen wird unterschieden.
|
||||
// $name und $Name sind zwei verschiedene Variablen.
|
||||
|
||||
echo "Hallo ";
|
||||
|
||||
$name = "Max Muster";
|
||||
$Name = "Barbara Beispiel";
|
||||
|
||||
echo $name;
|
||||
echo $Name;
|
||||
6
Kapitel_2/Lektion_5/5_variable_variablen.php
Normal file
6
Kapitel_2/Lektion_5/5_variable_variablen.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
$a = 'Wert von a';
|
||||
$b = 'a';
|
||||
|
||||
echo $$b;
|
||||
7
Kapitel_2/Lektion_6/1_zeichenketten_verketten.php
Normal file
7
Kapitel_2/Lektion_6/1_zeichenketten_verketten.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$vorname = 'Max';
|
||||
$nachname = 'Muster';
|
||||
|
||||
$name = $vorname . ' ' . $nachname;
|
||||
echo 'Hallo ' . $name;
|
||||
9
Kapitel_2/Lektion_6/2_anfuehrungszeichen.php
Normal file
9
Kapitel_2/Lektion_6/2_anfuehrungszeichen.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
$name = 'Max Muster';
|
||||
|
||||
// Einfache Anführungszeichen: Der Text bleibt unverändert.
|
||||
echo 'Hallo $name';
|
||||
|
||||
// Doppelte Anführungszeichen: Im Text vorkommende Variablen werden "maskiert", also durch ihren Wert ersetzt.
|
||||
echo "Hallo $name";
|
||||
9
Kapitel_2/Lektion_7/1_if.php
Normal file
9
Kapitel_2/Lektion_7/1_if.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
$a = 1;
|
||||
$b = 1;
|
||||
|
||||
if ($a == $b) {
|
||||
echo 'a und b sind gleich.';
|
||||
echo ' Und was sonst noch zu sagen wäre.';
|
||||
}
|
||||
11
Kapitel_2/Lektion_7/2_if_else.php
Normal file
11
Kapitel_2/Lektion_7/2_if_else.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
$a = 1;
|
||||
$b = 2;
|
||||
|
||||
if ($a == $b) {
|
||||
echo 'a und b sind gleich';
|
||||
echo ' Und was sonst noch zu sagen wäre.';
|
||||
} else {
|
||||
echo 'a und b sind NICHT gleich';
|
||||
}
|
||||
5
Kapitel_2/Lektion_8/1_for.php
Normal file
5
Kapitel_2/Lektion_8/1_for.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
echo $i . '<br>';
|
||||
}
|
||||
8
Kapitel_2/Lektion_8/2_while.php
Normal file
8
Kapitel_2/Lektion_8/2_while.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
$i = 10;
|
||||
|
||||
while ($i < 20) {
|
||||
echo $i . '<br>';
|
||||
$i++;
|
||||
}
|
||||
15
Kapitel_2/Lektion_9/1_grundrechenarten.php
Normal file
15
Kapitel_2/Lektion_9/1_grundrechenarten.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
echo 7 + 3;
|
||||
echo '<br>';
|
||||
|
||||
echo 7 - 3;
|
||||
echo '<br>';
|
||||
|
||||
echo 7 * 3;
|
||||
echo '<br>';
|
||||
|
||||
echo 7 / 3;
|
||||
echo '<br>';
|
||||
|
||||
echo 7 / 0;
|
||||
15
Kapitel_2/Lektion_9/2_mit_variablen_rechnen.php
Normal file
15
Kapitel_2/Lektion_9/2_mit_variablen_rechnen.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
$a = 10;
|
||||
$b = 20;
|
||||
|
||||
echo $a + $b;
|
||||
echo '<br>';
|
||||
|
||||
$summe = $a + $b;
|
||||
echo $summe;
|
||||
echo '<br>';
|
||||
|
||||
echo "<p>Summe: " . $summe . "</p>";
|
||||
|
||||
echo "<p>Summe: " . ($a + $b) . "</p>";
|
||||
6
Kapitel_2/Lektion_9/3_punkt_vor_strich.php
Normal file
6
Kapitel_2/Lektion_9/3_punkt_vor_strich.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
echo 1 + 2 * 3;
|
||||
echo '<br>';
|
||||
|
||||
echo (1 + 2) * 3;
|
||||
21
Kapitel_2/Lektion_9/4_variablen_inkrementieren.php
Normal file
21
Kapitel_2/Lektion_9/4_variablen_inkrementieren.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
$a = 3;
|
||||
$a = $a + 4;
|
||||
echo $a;
|
||||
echo '<br>';
|
||||
|
||||
$a = 3;
|
||||
$a += 4;
|
||||
echo $a;
|
||||
echo '<br>';
|
||||
|
||||
$a = 3;
|
||||
$a++;
|
||||
echo $a;
|
||||
echo '<br>';
|
||||
|
||||
$a = 3;
|
||||
$a--;
|
||||
echo $a;
|
||||
echo '<br>';
|
||||
5
Kapitel_2/Lektion_9/5_fliesskommazahlen.php
Normal file
5
Kapitel_2/Lektion_9/5_fliesskommazahlen.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
$x = 1.5;
|
||||
$y = 2.3;
|
||||
echo $x + $y;
|
||||
6
Kapitel_2/Lektion_9/6_potenzen.php
Normal file
6
Kapitel_2/Lektion_9/6_potenzen.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
echo pow(2, 3);
|
||||
echo '<br>';
|
||||
|
||||
echo 2 ** 3;
|
||||
Reference in New Issue
Block a user