3v4l.org

run code in 300+ PHP versions simultaneously
<?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 git.master, git.master_jit, rfc.property-hooks
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 ) )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
52.36 ms | 413 KiB | 8 Q