Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $weas = [
- [
- 'ip_address' => '170.239.86.148',
- 'central_report' => 'b.barracudacentral.org',
- 'status_ip' => 'blocked',
- 'fecha_status' => '2018-01-18',
- ],
- [
- 'ip_address' => '186.64.123.67',
- 'central_report' => 'b.barracudacentral.org',
- 'status_ip' => 'blocked',
- 'fecha_status' => '2018-01-18',
- ],
- [
- 'ip_address' => '186.64.123.67',
- 'central_report' => 'cbl.abuseat.org',
- 'status_ip' => 'blocked',
- 'fecha_status' => '2018-01-18',
- ],
- [
- 'ip_address' => '186.64.123.67',
- 'central_report' => 'spam.dnsbl.sorbs.net',
- 'status_ip' => 'blocked',
- 'fecha_status' => '2018-01-18',
- ]
- ];
- $datos = [];
- foreach ($weas as $valor) {
- $ip = $valor['ip_address'];
- $central = $valor['central_report'];
- if (!array_key_exists($ip, $datos)) {
- $datos[$ip]['central'] = [];
- }
- $datos[$ip]['central'][] = $central;
- }
- var_dump($datos);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement