<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
ini_set('html_errors', false);
$cats = array(
(object) array("term_id"=>"","name"=>"Film : FIILMTOFTWFUT : post-COLON2","slug" => "alphabetical-k-l-m-n-o ","term_group"=>5,"term_taxonomy_id"=>9,"taxonomy"=>"Myanmar","description"=>"69509","parent"=>"","count"=>"1"),
(object) array("term_id"=>"","name"=> "Country: Cambodia ","slug"=>"Media Relations","term_group"=>5,"term_taxonomy_id"=>7,"taxonomy"=>"Belgium","description"=>"14234","parent"=>"","count"=>"1"),
(object) array("term_id"=>"","name"=>"Advertising","slug"=>"Quality Assurance","term_group"=>5,"term_taxonomy_id"=>1,"taxonomy"=>"Norfolk Island","description"=>"93236","parent"=>"","count"=>"1"),
(object) array("term_id"=>"","name"=>"Finances","slug"=>"Legal Department","term_group"=>5,"term_taxonomy_id"=>5,"taxonomy"=>"Honduras","description"=>"74759","parent"=>"","count"=>"1"),
(object) array("term_id"=>"","name"=>"Legal Department","slug"=>"Media Relations","term_group"=>1,"term_taxonomy_id"=>9,"taxonomy"=>"Namibia","description"=>"69625","parent"=>"","count"=>"1"),
(object) array("term_id"=>"","name"=>"Sales and Marketing","slug"=>"Advertising","term_group"=>2,"term_taxonomy_id"=>4,"taxonomy"=>"Syria","description"=>"56469","parent"=>"","count"=>"1"),
(object) array("term_id"=>"","name"=>"Finances","slug"=>"Media Relations","term_group"=>5,"term_taxonomy_id"=>8,"taxonomy"=>"Ethiopia","description"=>"74909","parent"=>"","count"=>"1"),
(object) array("term_id"=>"","name"=>"Media Relations","slug"=>"Asset Management","term_group"=>5,"term_taxonomy_id"=>9,"taxonomy"=>"Indonesia","description"=>"17623","parent"=>"","count"=>"1"),
(object) array("term_id"=>"","name"=>"Finances","slug"=>"Customer Relations","term_group"=>2,"term_taxonomy_id"=>3,"taxonomy"=>"Zimbabwe","description"=>"83249","parent"=>"","count"=>"1"),
(object) array("term_id"=>"","name"=>"Sales and Marketing","slug" => "alphabetical-k-l-m-n-o ","term_group"=>1,"term_taxonomy_id"=>10,"taxonomy"=>"Faroe Islands","description"=>"03778","parent"=>"","count"=>"1"),
(object) array("term_id"=>"","name"=>"Sales and Marketing","slug"=>"Sales and Marketing","term_group"=>7,"term_taxonomy_id"=>3,"taxonomy"=>"Latvia","description"=>"68525","parent"=>"","count"=>"1"),
(object) array("term_id"=>"","name"=>"Accounting","slug"=>"Research and Development","term_group"=>9,"term_taxonomy_id"=>7,"taxonomy"=>"Bouvet Island","description"=>"18959","parent"=>"","count"=>"1"),
(object) array("term_id"=>"","name"=>"Asset Management","slug"=>"Advertising","term_group"=>1,"term_taxonomy_id"=>9,"taxonomy"=>"Tajikistan","description"=>"94796","parent"=>"","count"=>"1"),
(object) array("term_id"=>"","name"=>"Tech Support : arstatf","slug"=>"Accounting","term_group"=>5,"term_taxonomy_id"=>7,"taxonomy"=>"Côte D'Ivoire (Ivory Coast)","description"=>"24209","parent"=>"","count"=>"1"),
(object) array("term_id"=>"","name"=>"Film : FIILMTOFTWFUT : post-COLON2","slug"=>"Human Resources","term_group"=>9,"term_taxonomy_id"=>3,"taxonomy"=>"Ukraine","description"=>"77647","parent"=>"","count"=>"1"),
(object) array("term_id"=>"","name"=>"Media Relations","slug"=>"Customer Service","term_group"=>6,"term_taxonomy_id"=>7,"taxonomy"=>"Maldives","description"=>"97264","parent"=>"","count"=>"1")
);
//list($k, $v) =
//print_r(explode(' ',$cat->name,2));
//$result[$k]=$v;
// $result[] = array_map(function($v){
// return explode(" ", $v);
// }, $cat);
function getStuff($o) {
//$z= get_object_vars($o);
//print $o->name;
$o = (array)$o;
list($o['name']) = explode(' ',$o['name'],2);
// print "{$o['name']} \n";
return $o=(object)$o;
// print "{$o->name} \n";
//print $o=>name;
//return $z;
// explode(' ',$o->name,2)[0]//]= explode('',$o->name,2)[1];
// $o = (object) array_merge( (array)$o, array( explode(' ',$o->name,2)[0] => '1234' ) );
;
}
$a=array_map('getStuff', $cats);
print_r($a)
/* $newArr = array();
foreach($cats as $cat){
$newArr[$cat->name][] = (array)$cat;
}
var_dump($newArr);*/
?>
- Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
- Array
(
[0] => stdClass Object
(
[term_id] =>
[name] => Film
[slug] => alphabetical-k-l-m-n-o
[term_group] => 5
[term_taxonomy_id] => 9
[taxonomy] => Myanmar
[description] => 69509
[parent] =>
[count] => 1
)
[1] => stdClass Object
(
[term_id] =>
[name] => Country:
[slug] => Media Relations
[term_group] => 5
[term_taxonomy_id] => 7
[taxonomy] => Belgium
[description] => 14234
[parent] =>
[count] => 1
)
[2] => stdClass Object
(
[term_id] =>
[name] => Advertising
[slug] => Quality Assurance
[term_group] => 5
[term_taxonomy_id] => 1
[taxonomy] => Norfolk Island
[description] => 93236
[parent] =>
[count] => 1
)
[3] => stdClass Object
(
[term_id] =>
[name] => Finances
[slug] => Legal Department
[term_group] => 5
[term_taxonomy_id] => 5
[taxonomy] => Honduras
[description] => 74759
[parent] =>
[count] => 1
)
[4] => stdClass Object
(
[term_id] =>
[name] => Legal
[slug] => Media Relations
[term_group] => 1
[term_taxonomy_id] => 9
[taxonomy] => Namibia
[description] => 69625
[parent] =>
[count] => 1
)
[5] => stdClass Object
(
[term_id] =>
[name] => Sales
[slug] => Advertising
[term_group] => 2
[term_taxonomy_id] => 4
[taxonomy] => Syria
[description] => 56469
[parent] =>
[count] => 1
)
[6] => stdClass Object
(
[term_id] =>
[name] => Finances
[slug] => Media Relations
[term_group] => 5
[term_taxonomy_id] => 8
[taxonomy] => Ethiopia
[description] => 74909
[parent] =>
[count] => 1
)
[7] => stdClass Object
(
[term_id] =>
[name] => Media
[slug] => Asset Management
[term_group] => 5
[term_taxonomy_id] => 9
[taxonomy] => Indonesia
[description] => 17623
[parent] =>
[count] => 1
)
[8] => stdClass Object
(
[term_id] =>
[name] => Finances
[slug] => Customer Relations
[term_group] => 2
[term_taxonomy_id] => 3
[taxonomy] => Zimbabwe
[description] => 83249
[parent] =>
[count] => 1
)
[9] => stdClass Object
(
[term_id] =>
[name] => Sales
[slug] => alphabetical-k-l-m-n-o
[term_group] => 1
[term_taxonomy_id] => 10
[taxonomy] => Faroe Islands
[description] => 03778
[parent] =>
[count] => 1
)
[10] => stdClass Object
(
[term_id] =>
[name] => Sales
[slug] => Sales and Marketing
[term_group] => 7
[term_taxonomy_id] => 3
[taxonomy] => Latvia
[description] => 68525
[parent] =>
[count] => 1
)
[11] => stdClass Object
(
[term_id] =>
[name] => Accounting
[slug] => Research and Development
[term_group] => 9
[term_taxonomy_id] => 7
[taxonomy] => Bouvet Island
[description] => 18959
[parent] =>
[count] => 1
)
[12] => stdClass Object
(
[term_id] =>
[name] => Asset
[slug] => Advertising
[term_group] => 1
[term_taxonomy_id] => 9
[taxonomy] => Tajikistan
[description] => 94796
[parent] =>
[count] => 1
)
[13] => stdClass Object
(
[term_id] =>
[name] => Tech
[slug] => Accounting
[term_group] => 5
[term_taxonomy_id] => 7
[taxonomy] => Côte D'Ivoire (Ivory Coast)
[description] => 24209
[parent] =>
[count] => 1
)
[14] => stdClass Object
(
[term_id] =>
[name] => Film
[slug] => Human Resources
[term_group] => 9
[term_taxonomy_id] => 3
[taxonomy] => Ukraine
[description] => 77647
[parent] =>
[count] => 1
)
[15] => stdClass Object
(
[term_id] =>
[name] => Media
[slug] => Customer Service
[term_group] => 6
[term_taxonomy_id] => 7
[taxonomy] => Maldives
[description] => 97264
[parent] =>
[count] => 1
)
)
- Output for 8.3.5
- Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Array
(
[0] => stdClass Object
(
[term_id] =>
[name] => Film
[slug] => alphabetical-k-l-m-n-o
[term_group] => 5
[term_taxonomy_id] => 9
[taxonomy] => Myanmar
[description] => 69509
[parent] =>
[count] => 1
)
[1] => stdClass Object
(
[term_id] =>
[name] => Country:
[slug] => Media Relations
[term_group] => 5
[term_taxonomy_id] => 7
[taxonomy] => Belgium
[description] => 14234
[parent] =>
[count] => 1
)
[2] => stdClass Object
(
[term_id] =>
[name] => Advertising
[slug] => Quality Assurance
[term_group] => 5
[term_taxonomy_id] => 1
[taxonomy] => Norfolk Island
[description] => 93236
[parent] =>
[count] => 1
)
[3] => stdClass Object
(
[term_id] =>
[name] => Finances
[slug] => Legal Department
[term_group] => 5
[term_taxonomy_id] => 5
[taxonomy] => Honduras
[description] => 74759
[parent] =>
[count] => 1
)
[4] => stdClass Object
(
[term_id] =>
[name] => Legal
[slug] => Media Relations
[term_group] => 1
[term_taxonomy_id] => 9
[taxonomy] => Namibia
[description] => 69625
[parent] =>
[count] => 1
)
[5] => stdClass Object
(
[term_id] =>
[name] => Sales
[slug] => Advertising
[term_group] => 2
[term_taxonomy_id] => 4
[taxonomy] => Syria
[description] => 56469
[parent] =>
[count] => 1
)
[6] => stdClass Object
(
[term_id] =>
[name] => Finances
[slug] => Media Relations
[term_group] => 5
[term_taxonomy_id] => 8
[taxonomy] => Ethiopia
[description] => 74909
[parent] =>
[count] => 1
)
[7] => stdClass Object
(
[term_id] =>
[name] => Media
[slug] => Asset Management
[term_group] => 5
[term_taxonomy_id] => 9
[taxonomy] => Indonesia
[description] => 17623
[parent] =>
[count] => 1
)
[8] => stdClass Object
(
[term_id] =>
[name] => Finances
[slug] => Customer Relations
[term_group] => 2
[term_taxonomy_id] => 3
[taxonomy] => Zimbabwe
[description] => 83249
[parent] =>
[count] => 1
)
[9] => stdClass Object
(
[term_id] =>
[name] => Sales
[slug] => alphabetical-k-l-m-n-o
[term_group] => 1
[term_taxonomy_id] => 10
[taxonomy] => Faroe Islands
[description] => 03778
[parent] =>
[count] => 1
)
[10] => stdClass Object
(
[term_id] =>
[name] => Sales
[slug] => Sales and Marketing
[term_group] => 7
[term_taxonomy_id] => 3
[taxonomy] => Latvia
[description] => 68525
[parent] =>
[count] => 1
)
[11] => stdClass Object
(
[term_id] =>
[name] => Accounting
[slug] => Research and Development
[term_group] => 9
[term_taxonomy_id] => 7
[taxonomy] => Bouvet Island
[description] => 18959
[parent] =>
[count] => 1
)
[12] => stdClass Object
(
[term_id] =>
[name] => Asset
[slug] => Advertising
[term_group] => 1
[term_taxonomy_id] => 9
[taxonomy] => Tajikistan
[description] => 94796
[parent] =>
[count] => 1
)
[13] => stdClass Object
(
[term_id] =>
[name] => Tech
[slug] => Accounting
[term_group] => 5
[term_taxonomy_id] => 7
[taxonomy] => Côte D'Ivoire (Ivory Coast)
[description] => 24209
[parent] =>
[count] => 1
)
[14] => stdClass Object
(
[term_id] =>
[name] => Film
[slug] => Human Resources
[term_group] => 9
[term_taxonomy_id] => 3
[taxonomy] => Ukraine
[description] => 77647
[parent] =>
[count] => 1
)
[15] => stdClass Object
(
[term_id] =>
[name] => Media
[slug] => Customer Service
[term_group] => 6
[term_taxonomy_id] => 7
[taxonomy] => Maldives
[description] => 97264
[parent] =>
[count] => 1
)
)
preferences:
274.7 ms | 413 KiB | 342 Q