Home >Backend Development >PHP Tutorial >PHP two-dimensional array to get data based on conditions_PHP tutorial

PHP two-dimensional array to get data based on conditions_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:43:081679browse

There is an array $point_arr (as shown below), take out the array row with user_id = 3.
The code is as follows:
//Your array
$point_arr = array(
                                                                                                     "point"=>2),
array("id"=>2,"id"=>3,"point"=>2),
array("id"=> 3,"id"=>3,"point"=>2),
array("id"=>4,"id"=>3,"point"=>2),
); 🎜>                                    //$new is a new array used to receive user_id=3.
$ New [] = $ point_arr [$ i];
}
}
// Output new array.
for($i = 0;$i                           print_r($new[$i]);                                                                                                                                                                
}
?>



http://www.bkjia.com/PHPjc/478845.html

www.bkjia.com

http: //www.bkjia.com/PHPjc/478845.htmlTechArticleThere is an array $point_arr (as shown below), take out the array row with user_id = 3. The code is as follows: ?php //Your array $point_arr = array( array("id"=1,"id"=1,"point"=2), array("id"=2,"id"=3, ...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn