دورة php للمبتدئين الدرس الخامس عشر
1- كيفاش نزيد array multidimensionnelle ف php
<?php
$employes = array(
array(
'samadi','34','Taza'
),
array(
'amine','30','Taza'
),array(
'hassan','25','Taza'
)
);
?>
2- كيفاش نعرض القيم لي فل array multidimensionnelle
<?php
$employes = array(
array(
'samadi','34','Taza'
),
array(
'amine','30','Taza'
),array(
'hassan','25','Taza'
)
);
echo 'Noms:'.$employes[0][0].' '.$employes[1][0].' '.$employes[2][0].'<br>';
echo 'Ages:'.$employes[0][1].' '.$employes[1][1].' '.$employes[2][1].'<br>';
echo 'Villes:'.$employes[0][2].' '.$employes[1][2].' '.$employes[2][2].'<br>';
?>
3- عرض القيم بل boucle for
<?php
$employes = array(
array(
'samadi','34','Taza'
),
array(
'amine','30','Taza'
),array(
'hassan','25','Taza'
)
);
// echo 'Noms:'.$employes[0][0].' '.$employes[1][0].' '.$employes[2][0].'<br>';
// echo 'Ages:'.$employes[0][1].' '.$employes[1][1].' '.$employes[2][1].'<br>';
// echo 'Villes:'.$employes[0][2].' '.$employes[1][2].' '.$employes[2][2].'<br>';
for($i=0;$i<3;$i++){
echo "<p><b>ligne: $i</b></p>";
echo "<ul>";
for ($j = 0; $j < 3; $j++) {
echo "<li>".$employes[$i][$j]."</li>";
}
echo "</ul>";
}
?>
4- كيفاش نعرض التاريخ ف php
<?php
// $employes = array(
// array(
// 'samadi','34','Taza'
// ),
// array(
// 'amine','30','Taza'
// ),array(
// 'hassan','25','Taza'
// )
// );
// echo 'Noms:'.$employes[0][0].' '.$employes[1][0].' '.$employes[2][0].'<br>';
// echo 'Ages:'.$employes[0][1].' '.$employes[1][1].' '.$employes[2][1].'<br>';
// echo 'Villes:'.$employes[0][2].' '.$employes[1][2].' '.$employes[2][2].'<br>';
// for($i=0;$i<3;$i++){
// echo "<p><b>ligne: $i</b></p>";
// echo "<ul>";
// for ($j = 0; $j < 3; $j++) {
// echo "<li>".$employes[$i][$j]."</li>";
// }
// echo "</ul>";
// }
//afficher la date
echo date('Y-m-d');
?>
5- كيفاش ن afficher حقوق النشر اتوماتيكيا
<?php
// $employes = array(
// array(
// 'samadi','34','Taza'
// ),
// array(
// 'amine','30','Taza'
// ),array(
// 'hassan','25','Taza'
// )
// );
// echo 'Noms:'.$employes[0][0].' '.$employes[1][0].' '.$employes[2][0].'<br>';
// echo 'Ages:'.$employes[0][1].' '.$employes[1][1].' '.$employes[2][1].'<br>';
// echo 'Villes:'.$employes[0][2].' '.$employes[1][2].' '.$employes[2][2].'<br>';
// for($i=0;$i<3;$i++){
// echo "<p><b>ligne: $i</b></p>";
// echo "<ul>";
// for ($j = 0; $j < 3; $j++) {
// echo "<li>".$employes[$i][$j]."</li>";
// }
// echo "</ul>";
// }
//afficher la date
// echo date('Y-m-d');
//copyright
echo '© 2016-'.' '.date("Y");
?>