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; $nameParts = explode(' ',$o['name'],2); list($o['category'], $o['name']) = $nameParts; return $o=(object)$o; ; } $a=array_map('getStuff', $cats); //var_dump($a); foreach($a as $element) { $categories[$element->category][] = $element; } /* $filtered_categories = array(); foreach($a as $element => $value) { $filtered_categories[$value->category][$key] = $value; echo "{$filtered_categories[$value->category][$key]}, {$value}\n"; } ksort($filtered_categories, SORT_REGULAR); //foreach ($filtered_categories as $key => $val) { // echo "$key = $val\n"; //} */ ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 50, Position 2 = 56
Branch analysis from position: 50
2 jumps found. (Code = 78) Position 1 = 51, Position 2 = 56
Branch analysis from position: 51
1 jumps found. (Code = 42) Position 1 = 50
Branch analysis from position: 50
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 56
filename:       /in/F6Ms5
function name:  (null)
number of ops:  58
compiled vars:  !0 = $cats, !1 = $a, !2 = $element, !3 = $categories
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 32767
          2        DO_ICALL                                                 
    5     3        INIT_FCALL                                               'ini_set'
          4        SEND_VAL                                                 'display_errors'
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                                 
    6     7        INIT_FCALL                                               'ini_set'
          8        SEND_VAL                                                 'html_errors'
          9        SEND_VAL                                                 <false>
         10        DO_ICALL                                                 
   10    11        CAST                                          8  ~7      <array>
         12        INIT_ARRAY                                       ~8      ~7
   11    13        CAST                                          8  ~9      <array>
         14        ADD_ARRAY_ELEMENT                                ~8      ~9
   12    15        CAST                                          8  ~10     <array>
         16        ADD_ARRAY_ELEMENT                                ~8      ~10
   13    17        CAST                                          8  ~11     <array>
         18        ADD_ARRAY_ELEMENT                                ~8      ~11
   14    19        CAST                                          8  ~12     <array>
         20        ADD_ARRAY_ELEMENT                                ~8      ~12
   15    21        CAST                                          8  ~13     <array>
         22        ADD_ARRAY_ELEMENT                                ~8      ~13
   16    23        CAST                                          8  ~14     <array>
         24        ADD_ARRAY_ELEMENT                                ~8      ~14
   17    25        CAST                                          8  ~15     <array>
         26        ADD_ARRAY_ELEMENT                                ~8      ~15
   18    27        CAST                                          8  ~16     <array>
         28        ADD_ARRAY_ELEMENT                                ~8      ~16
   19    29        CAST                                          8  ~17     <array>
         30        ADD_ARRAY_ELEMENT                                ~8      ~17
   20    31        CAST                                          8  ~18     <array>
         32        ADD_ARRAY_ELEMENT                                ~8      ~18
   21    33        CAST                                          8  ~19     <array>
         34        ADD_ARRAY_ELEMENT                                ~8      ~19
   22    35        CAST                                          8  ~20     <array>
         36        ADD_ARRAY_ELEMENT                                ~8      ~20
   23    37        CAST                                          8  ~21     <array>
         38        ADD_ARRAY_ELEMENT                                ~8      ~21
   24    39        CAST                                          8  ~22     <array>
         40        ADD_ARRAY_ELEMENT                                ~8      ~22
   25    41        CAST                                          8  ~23     <array>
         42        ADD_ARRAY_ELEMENT                                ~8      ~23
    8    43        ASSIGN                                                   !0, ~8
   56    44        INIT_FCALL                                               'array_map'
         45        SEND_VAL                                                 'getStuff'
         46        SEND_VAR                                                 !0
         47        DO_ICALL                                         $25     
         48        ASSIGN                                                   !1, $25
   60    49      > FE_RESET_R                                       $27     !1, ->56
         50    > > FE_FETCH_R                                               $27, !2, ->56
   62    51    >   FETCH_OBJ_R                                      ~28     !2, 'category'
         52        FETCH_DIM_W                                      $29     !3, ~28
         53        ASSIGN_DIM                                               $29
         54        OP_DATA                                                  !2
   60    55      > JMP                                                      ->50
         56    >   FE_FREE                                                  $27
   76    57      > RETURN                                                   1

Function getstuff:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F6Ms5
function name:  getStuff
number of ops:  22
compiled vars:  !0 = $o, !1 = $nameParts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   RECV                                             !0      
   45     1        CAST                                          7  ~2      !0
          2        ASSIGN                                                   !0, ~2
   46     3        INIT_FCALL                                               'explode'
          4        SEND_VAL                                                 '+'
          5        FETCH_DIM_R                                      ~4      !0, 'name'
          6        SEND_VAL                                                 ~4
          7        SEND_VAL                                                 2
          8        DO_ICALL                                         $5      
          9        ASSIGN                                                   !1, $5
   47    10        QM_ASSIGN                                        ~7      !1
         11        FETCH_LIST_R                                     $8      ~7, 0
         12        ASSIGN_DIM                                               !0, 'category'
         13        OP_DATA                                                  $8
         14        FETCH_LIST_R                                     $10     ~7, 1
         15        ASSIGN_DIM                                               !0, 'name'
         16        OP_DATA                                                  $10
         17        FREE                                                     ~7
   50    18        CAST                                          8  ~12     !0
         19        ASSIGN                                           ~13     !0, ~12
         20      > RETURN                                                   ~13
   54    21*     > RETURN                                                   null

End of function getstuff

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.01 ms | 1400 KiB | 21 Q