My array is:
Array ( [0] => 652, 5850 [1] => 230, 9850 [2] => 201 ,13700 )
I stored the data by using this code:
$myarray=array();
if(!empty($_GET['check_list'])) {
// Loop to store and display values of individual checked checkbox.
foreach($_GET['check_list'] as $selected) {
$myarray[]=$selected;
}
print_r($myarray);
}
I want to extract this data like:
[roomno] =>652,230,201
[price] =>5850,9850,13700
How can I get this value?
Here is one possible way :
<?php
$array = [
0 => [652, 5850],
1 => [230, 9850],
2 => [201 ,13700]
];
$roomno = [];
$price = [];
foreach($array as $a){
$roomno[] = $a[0];
$price[] = $a[1];
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.