3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_jobs() { return json_decode('[ {"id":"28038a67e70c7e235fa725bbf8b6e167d9e3efee1e43a304d73be8408c6f24a2","posting_job_title":"Entry Level Sales Representative*","job_relationship":"w2_employee","location":"Aston, PA","territory_id":1,"territory_abbr":"PHL"}, {"id":"7f8bcb16e0f3ffe9c8ce9aff2b6033bfbe582241e818aaf9c21506d509e70592","posting_job_title":"Sales Representative*","job_relationship":"w2_employee","location":"Chester, PA","territory_id":1,"territory_abbr":"PHL"}, {"id":"7c6cc1c2abda3dae2edf0982f758073316491b27c240e5fa13df791e0fb5b744","posting_job_title":"Entry Level Sales Representative*","job_relationship":"w2_employee","location":"Aston, PA","territory_id":1,"territory_abbr":"PHL"}, {"id":"556b7ec84be0e6a5130cde5a441dc58ed595de5acd4e5f4883a2b2e6cc5eb4f4","posting_job_title":"Siding Subcontractors Needed- Up To $10,000 SIGN ON BONUS","job_relationship":"company","location":"Essex, MD","territory_id":3,"territory_abbr":"MD"}, {"id":"31f1752e8c3f1086b4a1ed499e8786e1d15a8d1825cb75848056333d1cae8276","posting_job_title":"Entry Level Sales Representative*","job_relationship":"w2_employee","location":"Bridgewater, NJ","territory_id":2,"territory_abbr":"NJ"}, {"id":"197c35000fb9b9ca1fe71771bb618c5443f0e7e51b59b9cad22f08d77d73de54","posting_job_title":"Siding Subcontractors Needed- Up To $10,000 SIGN ON BONUS","job_relationship":"company","location":"Aberdeen, MD","territory_id":3,"territory_abbr":"MD"}, {"id":"8621ae18266b571175358113fd3ed7147f2ffa7d248c71c8e1a78b566ac24628","posting_job_title":"Sales Representative*","job_relationship":"w2_employee","location":"Bronx, NY","territory_id":4,"territory_abbr":"CT"}, {"id":"bc2f7034687d2273f14bb2fa41fef8472f5e12ce8e483210b628167bba09c9aa","posting_job_title":"Sales Representative*","job_relationship":"w2_employee","location":"Greenwich, CT","territory_id":4,"territory_abbr":"CT"}, {"id":"5debdc91afd45080a7cb87912b9411f186793e3ad9be8fbf8fe7f40f85ce9d17","posting_job_title":"Entry Level Sales Representative*","job_relationship":"w2_employee","location":"Bayside, NY","territory_id":5,"territory_abbr":"LI"}, {"id":"3dc256cecd93030f3d4079b5a313277cc03f92fb2d991cf9b0b656a34f84425f","posting_job_title":"Entry Level Sales Representative*","job_relationship":"w2_employee","location":"Bayside, NY","territory_id":5,"territory_abbr":"LI"}, {"id":"8121cb7efb0e04130fbdc3f69468c7434c1582f71d71408ef689b81519d86a5c","posting_job_title":"Siding Subcontractors Needed- Up To $10,000 SIGN ON BONUS","job_relationship":"company","location":"Parkville, MD","territory_id":3,"territory_abbr":"MD"}, {"id":"269e4edc7ed745210c71e8b324a5f2f559ba793f1ff67d5e61b00ee48b992d89","posting_job_title":"Sales Representative*","job_relationship":"w2_employee","location":"Bayside, NY","territory_id":5,"territory_abbr":"LI"} ]', true); } function display_jobs() { $jobs = get_jobs(); usort($jobs, fn($a, $b) => $a['territory_id'] <=> $b['territory_id'] ?: $a['location'] <=> $b['location'] ); $groups = []; foreach ($jobs as $posting) { $groups[$posting['territory_abbr']][$posting['location']][] = $posting; } $html = ''; foreach ($groups as $terrAbbr => $locations) { $html .= <<<HTML <div style="border: solid 1px orange;"> <h3>$terrAbbr</h3> HTML; foreach ($locations as $locName => $postings) { $html .= <<<HTML <div style="border: solid 1px blue;"> <h4>$locName</h4> HTML; foreach ($postings as $posting) { $html .= sprintf(<<<HTML <div style="border: solid 1px green;"> <ul class="col"> <li>%s</li> <li>%s</li> <li>%s</li> <li>%s</li> <li>%s</li> <li>%s</li> </ul> </div> HTML, $posting['territory_abbr'], $posting['territory_id'], $posting['location'], $posting['id'], $posting['posting_job_title'], $posting['job_relationship'] ); } $html .= <<<HTML </div> HTML; } $html .= <<<HTML </div> HTML; } $html = $html ?: 'No data'; return <<<HTML <div style="border: solid 1px red;"> $html </div> HTML; } echo display_jobs();

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vLheG
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   87     0  E >   INIT_FCALL                                               'display_jobs'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
          3      > RETURN                                                   1

Function get_jobs:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vLheG
function name:  get_jobs
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'json_decode'
          1        SEND_VAL                                                 '%5B%0A%7B%22id%22%3A%2228038a67e70c7e235fa725bbf8b6e167d9e3efee1e43a304d73be8408c6f24a2%22%2C%22posting_job_title%22%3A%22Entry+Level+Sales+Representative%2A%22%2C%22job_relationship%22%3A%22w2_employee%22%2C%22location%22%3A%22Aston%2C+PA%22%2C%22territory_id%22%3A1%2C%22territory_abbr%22%3A%22PHL%22%7D%2C%0A%7B%22id%22%3A%227f8bcb16e0f3ffe9c8ce9aff2b6033bfbe582241e818aaf9c21506d509e70592%22%2C%22posting_job_title%22%3A%22Sales+Representative%2A%22%2C%22job_relationship%22%3A%22w2_employee%22%2C%22location%22%3A%22Chester%2C+PA%22%2C%22territory_id%22%3A1%2C%22territory_abbr%22%3A%22PHL%22%7D%2C%0A%7B%22id%22%3A%227c6cc1c2abda3dae2edf0982f758073316491b27c240e5fa13df791e0fb5b744%22%2C%22posting_job_title%22%3A%22Entry+Level+Sales+Representative%2A%22%2C%22job_relationship%22%3A%22w2_employee%22%2C%22location%22%3A%22Aston%2C+PA%22%2C%22territory_id%22%3A1%2C%22territory_abbr%22%3A%22PHL%22%7D%2C%0A%7B%22id%22%3A%22556b7ec84be0e6a5130cde5a441dc58ed595de5acd4e5f4883a2b2e6cc5eb4f4%22%2C%22posting_job_title%22%3A%22Siding+Subcontractors+Needed-+Up+To+%2410%2C000+SIGN+ON+BONUS%22%2C%22job_relationship%22%3A%22company%22%2C%22location%22%3A%22Essex%2C+MD%22%2C%22territory_id%22%3A3%2C%22territory_abbr%22%3A%22MD%22%7D%2C%0A%7B%22id%22%3A%2231f1752e8c3f1086b4a1ed499e8786e1d15a8d1825cb75848056333d1cae8276%22%2C%22posting_job_title%22%3A%22Entry+Level+Sales+Representative%2A%22%2C%22job_relationship%22%3A%22w2_employee%22%2C%22location%22%3A%22Bridgewater%2C+NJ%22%2C%22territory_id%22%3A2%2C%22territory_abbr%22%3A%22NJ%22%7D%2C%0A%7B%22id%22%3A%22197c35000fb9b9ca1fe71771bb618c5443f0e7e51b59b9cad22f08d77d73de54%22%2C%22posting_job_title%22%3A%22Siding+Subcontractors+Needed-+Up+To+%2410%2C000+SIGN+ON+BONUS%22%2C%22job_relationship%22%3A%22company%22%2C%22location%22%3A%22Aberdeen%2C+MD%22%2C%22territory_id%22%3A3%2C%22territory_abbr%22%3A%22MD%22%7D%2C%0A%7B%22id%22%3A%228621ae18266b571175358113fd3ed7147f2ffa7d248c71c8e1a78b566ac24628%22%2C%22posting_job_title%22%3A%22Sales+Representative%2A%22%2C%22job_relationship%22%3A%22w2_employee%22%2C%22location%22%3A%22Bronx%2C+NY%22%2C%22territory_id%22%3A4%2C%22territory_abbr%22%3A%22CT%22%7D%2C%0A%7B%22id%22%3A%22bc2f7034687d2273f14bb2fa41fef8472f5e12ce8e483210b628167bba09c9aa%22%2C%22posting_job_title%22%3A%22Sales+Representative%2A%22%2C%22job_relationship%22%3A%22w2_employee%22%2C%22location%22%3A%22Greenwich%2C+CT%22%2C%22territory_id%22%3A4%2C%22territory_abbr%22%3A%22CT%22%7D%2C%0A%7B%22id%22%3A%225debdc91afd45080a7cb87912b9411f186793e3ad9be8fbf8fe7f40f85ce9d17%22%2C%22posting_job_title%22%3A%22Entry+Level+Sales+Representative%2A%22%2C%22job_relationship%22%3A%22w2_employee%22%2C%22location%22%3A%22Bayside%2C+NY%22%2C%22territory_id%22%3A5%2C%22territory_abbr%22%3A%22LI%22%7D%2C%0A%7B%22id%22%3A%223dc256cecd93030f3d4079b5a313277cc03f92fb2d991cf9b0b656a34f84425f%22%2C%22posting_job_title%22%3A%22Entry+Level+Sales+Representative%2A%22%2C%22job_relationship%22%3A%22w2_employee%22%2C%22location%22%3A%22Bayside%2C+NY%22%2C%22territory_id%22%3A5%2C%22territory_abbr%22%3A%22LI%22%7D%2C%0A%7B%22id%22%3A%228121cb7efb0e04130fbdc3f69468c7434c1582f71d71408ef689b81519d86a5c%22%2C%22posting_job_title%22%3A%22Siding+Subcontractors+Needed-+Up+To+%2410%2C000+SIGN+ON+BONUS%22%2C%22job_relationship%22%3A%22company%22%2C%22location%22%3A%22Parkville%2C+MD%22%2C%22territory_id%22%3A3%2C%22territory_abbr%22%3A%22MD%22%7D%2C%0A%7B%22id%22%3A%22269e4edc7ed745210c71e8b324a5f2f559ba793f1ff67d5e61b00ee48b992d89%22%2C%22posting_job_title%22%3A%22Sales+Representative%2A%22%2C%22job_relationship%22%3A%22w2_employee%22%2C%22location%22%3A%22Bayside%2C+NY%22%2C%22territory_id%22%3A5%2C%22territory_abbr%22%3A%22LI%22%7D%0A%5D'
   17     2        SEND_VAL                                                 <true>
    4     3        DO_ICALL                                         $0      
   17     4      > RETURN                                                   $0
   18     5*     > RETURN                                                   null

End of function get_jobs

Function display_jobs:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 18
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 59
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 59
Branch analysis from position: 22
2 jumps found. (Code = 77) Position 1 = 28, Position 2 = 56
Branch analysis from position: 28
2 jumps found. (Code = 78) Position 1 = 29, Position 2 = 56
Branch analysis from position: 29
2 jumps found. (Code = 77) Position 1 = 35, Position 2 = 53
Branch analysis from position: 35
2 jumps found. (Code = 78) Position 1 = 36, Position 2 = 53
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
Branch analysis from position: 53
Branch analysis from position: 56
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 56
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 59
Branch analysis from position: 18
filename:       /in/vLheG
function name:  display_jobs
number of ops:  68
compiled vars:  !0 = $jobs, !1 = $groups, !2 = $posting, !3 = $html, !4 = $locations, !5 = $terrAbbr, !6 = $postings, !7 = $locName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'get_jobs'
          1        DO_FCALL                                      0  $8      
          2        ASSIGN                                                   !0, $8
   23     3        INIT_FCALL                                               'usort'
          4        SEND_REF                                                 !0
          5        DECLARE_LAMBDA_FUNCTION                          ~10     [0]
   26     6        SEND_VAL                                                 ~10
   23     7        DO_ICALL                                                 
   28     8        ASSIGN                                                   !1, <array>
   29     9      > FE_RESET_R                                       $13     !0, ->18
         10    > > FE_FETCH_R                                               $13, !2, ->18
   30    11    >   FETCH_DIM_R                                      ~14     !2, 'territory_abbr'
         12        FETCH_DIM_R                                      ~16     !2, 'location'
         13        FETCH_DIM_W                                      $15     !1, ~14
         14        FETCH_DIM_W                                      $17     $15, ~16
         15        ASSIGN_DIM                                               $17
         16        OP_DATA                                                  !2
   29    17      > JMP                                                      ->10
         18    >   FE_FREE                                                  $13
   33    19        ASSIGN                                                   !3, ''
   34    20      > FE_RESET_R                                       $20     !1, ->59
         21    > > FE_FETCH_R                                       ~21     $20, !4, ->59
         22    >   ASSIGN                                                   !5, ~21
   36    23        ROPE_INIT                                     3  ~24     '++++%3Cdiv+style%3D%22border%3A+solid+1px+orange%3B%22%3E%0A++++++++%3Ch3%3E'
   37    24        ROPE_ADD                                      1  ~24     ~24, !5
         25        ROPE_END                                      2  ~23     ~24, '%3C%2Fh3%3E%0A'
         26        ASSIGN_OP                                     8          !3, ~23
   41    27      > FE_RESET_R                                       $27     !4, ->56
         28    > > FE_FETCH_R                                       ~28     $27, !6, ->56
         29    >   ASSIGN                                                   !7, ~28
   43    30        ROPE_INIT                                     3  ~31     '++++++++%3Cdiv+style%3D%22border%3A+solid+1px+blue%3B%22%3E%0A++++++++++++%3Ch4%3E'
   44    31        ROPE_ADD                                      1  ~31     ~31, !7
         32        ROPE_END                                      2  ~30     ~31, '%3C%2Fh4%3E%0A'
         33        ASSIGN_OP                                     8          !3, ~30
   48    34      > FE_RESET_R                                       $34     !6, ->53
         35    > > FE_FETCH_R                                               $34, !2, ->53
   49    36    >   INIT_FCALL                                               'sprintf'
   50    37        SEND_VAL                                                 '++++++++++++%3Cdiv+style%3D%22border%3A+solid+1px+green%3B%22%3E%0A++++++++++++++++%3Cul+class%3D%22col%22%3E%0A++++++++++++++++++++%3Cli%3E%25s%3C%2Fli%3E%0A++++++++++++++++++++%3Cli%3E%25s%3C%2Fli%3E%0A++++++++++++++++++++%3Cli%3E%25s%3C%2Fli%3E%0A++++++++++++++++++++%3Cli%3E%25s%3C%2Fli%3E%0A++++++++++++++++++++%3Cli%3E%25s%3C%2Fli%3E%0A++++++++++++++++++++%3Cli%3E%25s%3C%2Fli%3E%0A++++++++++++++++%3C%2Ful%3E%0A++++++++++++%3C%2Fdiv%3E%0A'
   62    38        FETCH_DIM_R                                      ~35     !2, 'territory_abbr'
         39        SEND_VAL                                                 ~35
   63    40        FETCH_DIM_R                                      ~36     !2, 'territory_id'
         41        SEND_VAL                                                 ~36
   64    42        FETCH_DIM_R                                      ~37     !2, 'location'
         43        SEND_VAL                                                 ~37
   65    44        FETCH_DIM_R                                      ~38     !2, 'id'
         45        SEND_VAL                                                 ~38
   66    46        FETCH_DIM_R                                      ~39     !2, 'posting_job_title'
         47        SEND_VAL                                                 ~39
   67    48        FETCH_DIM_R                                      ~40     !2, 'job_relationship'
         49        SEND_VAL                                                 ~40
   49    50        DO_ICALL                                         $41     
   67    51        ASSIGN_OP                                     8          !3, $41
   48    52      > JMP                                                      ->35
         53    >   FE_FREE                                                  $34
   71    54        ASSIGN_OP                                     8          !3, '++++++++%3C%2Fdiv%3E%0A'
   41    55      > JMP                                                      ->28
         56    >   FE_FREE                                                  $27
   76    57        ASSIGN_OP                                     8          !3, '++++%3C%2Fdiv%3E%0A'
   34    58      > JMP                                                      ->21
         59    >   FE_FREE                                                  $20
   80    60        JMP_SET                                          ~45     !3, ->62
         61        QM_ASSIGN                                        ~45     'No+data'
         62        ASSIGN                                                   !3, ~45
   82    63        ROPE_INIT                                     3  ~48     '%3Cdiv+style%3D%22border%3A+solid+1px+red%3B%22%3E%0A'
   83    64        ROPE_ADD                                      1  ~48     ~48, !3
         65        ROPE_END                                      2  ~47     ~48, '%0A%3C%2Fdiv%3E'
         66      > RETURN                                                   ~47
   86    67*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vLheG
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   24     2        FETCH_DIM_R                                      ~2      !0, 'territory_id'
          3        FETCH_DIM_R                                      ~3      !1, 'territory_id'
          4        SPACESHIP                                        ~4      ~2, ~3
          5        JMP_SET                                          ~5      ~4, ->10
   25     6        FETCH_DIM_R                                      ~6      !0, 'location'
          7        FETCH_DIM_R                                      ~7      !1, 'location'
          8        SPACESHIP                                        ~8      ~6, ~7
          9        QM_ASSIGN                                        ~5      ~8
         10      > RETURN                                                   ~5
   26    11*     > RETURN                                                   null

End of Dynamic Function 0

End of function display_jobs

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
193.24 ms | 1019 KiB | 18 Q