-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforeach.php
More file actions
108 lines (91 loc) · 2.33 KB
/
Copy pathforeach.php
File metadata and controls
108 lines (91 loc) · 2.33 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
102
103
104
105
106
107
108
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="icon" href="assets/images/logo.png" type="image/gif" sizes="16x16">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<?php
// $number = array("1"=>"Rakib","Hosen","Natok","Muvi");
// intreged array
// For Loop This a Bilding function .... arokom onek Function ace je php te bilt kora ace
$defarent = array('shuchi','kuchi','rakib','rana','rasel');
$langth = count($defarent);
echo $langth;
for ($i=0; $i < $langth; $i++) {
echo $defarent[$i].",<br>";
}
echo "<br><br><br>";
// Array How many Type =>Specifying with array()
$defarent = array(
'tmi1'=>'shuchi',
'tmi2'=>'kuchi',
'tmi3'=>'rakib',
'tmi4'=>'rana',
'tmi5'=>'rasel'
);
foreach($defarent as $key=>$newname){
echo $key." ".$newname.'<br>';
}
echo "<br><br><br>";
// Multidumentional Array
echo "<br><br><br>";
$motor = array(
array('Hero', 'hero honda+', 'Hero Spander+', 'Hank'),
array('Bajaj', 'CT100', 'Discover 25', 'Discover 100', 'palsear','Daying'),
array('Yamaha', 'yamaha FZ', 'yamaha saluto', 'yamaha fazer'),
array('TVS', 'TVS metro', 'TVS Apache', 'Tvs Stryker')
);
$motorrow = count($motor);
// $subrow = count();
// echo $subrow;
// Multi dymentional array + for loop
for($row=0;$row<$motorrow;$row++){
echo "Row Number = $row";
$motorcol = count($motor[$row]);
echo "<ul>";
for($col=0;$col<$motorcol;$col++){ ?>
<ul>
<li><a href="<?php echo $adata = $motor[$row][$col]; ?>">
<?php
$adata = $motor[$row][$col];
echo $adata;
?>
</a></li>
</ul>
<?php
}
}
echo "<br><br><br>";
$st_list = array(
array('Rakib', 'Rubel', 'Shanto', 'joy'),
array('suci', 'sumi', 'lipi', 'Ruma', 'sima','rubi'),
array('Foysal', 'Romjan', 'Bikash', 'Alomgir'),
array('Margiya', 'Taslima', 'Sarmin', 'Samsikhanom')
);
$i= 0;
// $st_list = array('Rakib', 'Rubel', 'Shanto', 'joy');
foreach($st_list as $st_new_list){
?>
<ul>
<li>
<?php
echo "Row Number :" .$i;
foreach($st_new_list as $value){
?>
<ul>
<li><a href="<?php echo $value; ?>"><?php echo $value; ?></a></li>
</ul>
<?php
}
?>
</li>
</ul>
<?php
$i++;
}
?>
</body>
</html>