-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathmult-dim-array.php
More file actions
49 lines (40 loc) · 1.8 KB
/
mult-dim-array.php
File metadata and controls
49 lines (40 loc) · 1.8 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
<?php
//$colors=array("Black","White","Green","Red");
$colors=array("black"=>"Black","white"=>"White","green"=>"Green","red"=>"Red");
//Multi Dim Array
$products=array(
array("pro_id"=>1,"pro_name"=>"Iphone","pro_price"=>"100,000","pro_url"=>"https://google.com"),
array("pro_id"=>1,"pro_name"=>"Iphone","pro_price"=>"100,000","pro_url"=>"https://google.com"),
array("pro_id"=>1,"pro_name"=>"Iphone","pro_price"=>"100,000","pro_url"=>"https://google.com"),
array("pro_id"=>1,"pro_name"=>"Iphone","pro_price"=>"100,000","pro_url"=>"https://google.com"),
array("pro_id"=>1,"pro_name"=>"Iphone","pro_price"=>"100,000","pro_url"=>"https://google.com"),
array("pro_id"=>1,"pro_name"=>"Iphone","pro_price"=>"100,000","pro_url"=>"https://google.com"),
array("pro_id"=>1,"pro_name"=>"Iphone","pro_price"=>"100,000","pro_url"=>"https://google.com"),
array("pro_id"=>1,"pro_name"=>"Iphone","pro_price"=>"100,000","pro_url"=>"https://google.com"),
array("pro_id"=>1,"pro_name"=>"Iphone","pro_price"=>"100,000","pro_url"=>"https://google.com"),
array("pro_id"=>1,"pro_name"=>"Iphone","pro_price"=>"100,000","pro_url"=>"https://google.com"),
array("pro_id"=>1,"pro_name"=>"Iphone","pro_price"=>"100,000","pro_url"=>"https://google.com"),
array("pro_id"=>1,"pro_name"=>"Iphone","pro_price"=>"100,000","pro_url"=>"https://google.com")
);
$pro_counter=1;
?>
<table>
<tr>
<?php
for($proloop=0;$proloop<count($products);$proloop++){
?>
<td>
<h1><?php echo $products[$proloop]["pro_name"]; ?></h1>
<b><?php echo $products[$proloop]["pro_price"]?></b>
<a href="<?php echo $products[$proloop]["pro_url"]?>">Buy Now</a>
</td>
<?php
if($pro_counter==3 && $proloop<count($products)-1){
$pro_counter=0;
echo "</tr><tr>";
}
$pro_counter++;
?>
<?php }?>
</tr>
</table>