/ Published in: PHP
                    
                                        
shows how to use array_map to mine data from nested arrays.
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
<?php
// from this nested array I want to extract only the user_id's
);
// this is how to do it using anonymous function
// Use a global function
function map_func($n){
return $n['User']['user_id'];
}
// Call a static function in a class
class MyMapper{
static function map_func($n){
return $n['User']['user_id'];
}
}
// Using a function from an object.
$myMapperObject = new MyMapper;
echo "=========================\n";
echo "=========================\n";
Comments
 Subscribe to comments
                    Subscribe to comments
                
                