forked from deoel/php-esis.16.17
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.php
More file actions
101 lines (84 loc) · 1.54 KB
/
test.php
File metadata and controls
101 lines (84 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
//test2
/*
if(isset($_POST['a']) and isset($_POST['b'])) {
$a = $_POST['a'];
$b = $_POST['b'];
$c = $a + $b;
if($c == 3) {
echo $a.' + '.$b.' = '.$c;
} else {
echo $a.' + '.$b.' = '.$c;
}
}*/
//test3
/*function tintin($a) {
$c = array();
foreach ($a as $b) {
$c[] = $a[$b];
}
return $c;
}
$d = array(5,3,4,1,0,2);
$s = tintin($d);
echo "<pre>";
print_r($s);
echo "</pre>";*/
//test3
/*function milou($a) {
return array_reverse($a);
}
$d = array(5,3,4,1,0,2);
$s = milou($d);
$l = array_flip($s);
echo "<pre>";
print_r($s);
print_r($l);
echo "</pre>";*/
//test5
/*function milou($a) {
$c = array();
foreach ($a as $b => $d) {
if($b % 2 == 0) {
array_unshift($c,$d);
}
}
return $c;
}
$d = array(5,3,4,1,0,2);
$s = milou($d); // [0,4,5]
echo "<pre>";
print_r($s);
echo "</pre>";*/
/*session_start();
if(isset($_POST['age1'], $_POST['age2'], $_POST['age3'])) {
if(!empty($_POST['age1']) and !empty($_POST['age2']) and !empty($_POST['age2'])) {
$age = array();
$age[] = $_POST['age1'];
$age[] = $_POST['age2'];
$age[] = $_POST['age3'];
$s = 0;
foreach($age as $a)
{
$s += $a;
}
$_SESSION['ageMoyen'] = $s / count($age);
}
}*/
/*
if(isset($_GET['mdp']) and !empty($_GET['mdp'])) {
$mdp = $_GET['mdp'];
if(preg_match('#^[a-zA-Z]{8,}$#',$mdp)) {
echo 'Good mdp';
} else {
echo 'Bad mdp';
}
}*/
$a = array(5, 6, 7);
$a[1] = array(8,6,2,9);
$c = 0;
foreach($a as $b => $d) {
$c += $b;
}
$a[1]['nice'] = $c;
?>