3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Deployment { /** * @param array<string, list<string>> $pipelineStages */ public function run(array $pipelineStages): void { $pipeline = new Fiber(function (array $pipelineStages): string { Fiber::suspend('Pipeline initialized.'); foreach ($pipelineStages as $stage => $steps) { foreach ($steps as $step) { Fiber::suspend("Stage '{$stage}': step '{$step}' completed."); } } return 'Deployment successful.'; }); $monitor = new Fiber(function (): string { Fiber::suspend('Monitoring system initialized.'); while (true) { Fiber::suspend('System health: OK.'); } }); $pipeline->start($pipelineStages); $monitor->start(); while (! $pipeline->isTerminated()) { printf("[Pipeline] %s\n", $pipeline->resume()); printf("[Monitor] %s\n", $monitor->resume()); } $result = $pipeline->getReturn(); printf("[Result] %s\n", $result); } } $stages = [ 'build' => ['compile', 'lint', 'optimize'], 'test' => ['unit', 'integration', 'e2e'], 'package' => ['zip', 'sign'], 'deploy' => ['upload', 'release', 'notify'], ]; (new Deployment())->run($stages);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8GI6K
function name:  (null)
number of ops:  7
compiled vars:  !0 = $stages
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   ASSIGN                                                   !0, <array>
   50     1        NEW                                              $2      'Deployment'
          2        DO_FCALL                                      0          
          3        INIT_METHOD_CALL                                         $2, 'run'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Class Deployment:
Function run:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 17
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 17
Branch analysis from position: 33
Branch analysis from position: 17
filename:       /in/8GI6K
function name:  run
number of ops:  41
compiled vars:  !0 = $pipelineStages, !1 = $pipeline, !2 = $monitor, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        NEW                                              $4      'Fiber'
          2        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
   20     3        SEND_VAL_EX                                              ~5
   10     4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $4
   22     6        NEW                                              $8      'Fiber'
          7        DECLARE_LAMBDA_FUNCTION                          ~9      [1]
   28     8        SEND_VAL_EX                                              ~9
   22     9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $8
   30    11        INIT_METHOD_CALL                                         !1, 'start'
         12        SEND_VAR_EX                                              !0
         13        DO_FCALL                                      0          
   31    14        INIT_METHOD_CALL                                         !2, 'start'
         15        DO_FCALL                                      0          
   33    16      > JMP                                                      ->29
   34    17    >   INIT_FCALL                                               'printf'
         18        SEND_VAL                                                 '%5BPipeline%5D+%25s%0A'
         19        INIT_METHOD_CALL                                         !1, 'resume'
         20        DO_FCALL                                      0  $14     
         21        SEND_VAR                                                 $14
         22        DO_ICALL                                                 
   35    23        INIT_FCALL                                               'printf'
         24        SEND_VAL                                                 '%5BMonitor%5D++%25s%0A'
         25        INIT_METHOD_CALL                                         !2, 'resume'
         26        DO_FCALL                                      0  $16     
         27        SEND_VAR                                                 $16
         28        DO_ICALL                                                 
   33    29    >   INIT_METHOD_CALL                                         !1, 'isTerminated'
         30        DO_FCALL                                      0  $18     
         31        BOOL_NOT                                         ~19     $18
         32      > JMPNZ                                                    ~19, ->17
   38    33    >   INIT_METHOD_CALL                                         !1, 'getReturn'
         34        DO_FCALL                                      0  $20     
         35        ASSIGN                                                   !3, $20
   39    36        INIT_FCALL                                               'printf'
         37        SEND_VAL                                                 '%5BResult%5D+++%25s%0A'
         38        SEND_VAR                                                 !3
         39        DO_ICALL                                                 
   40    40      > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 20
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 20
Branch analysis from position: 6
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 18
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/8GI6K
function name:  {closure}
number of ops:  24
compiled vars:  !0 = $pipelineStages, !1 = $steps, !2 = $stage, !3 = $step
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_STATIC_METHOD_CALL                                  'Fiber', 'suspend'
          2        SEND_VAL                                                 'Pipeline+initialized.'
          3        DO_FCALL                                      0          
   13     4      > FE_RESET_R                                       $5      !0, ->20
          5    > > FE_FETCH_R                                       ~6      $5, !1, ->20
          6    >   ASSIGN                                                   !2, ~6
   14     7      > FE_RESET_R                                       $8      !1, ->18
          8    > > FE_FETCH_R                                               $8, !3, ->18
   15     9    >   INIT_STATIC_METHOD_CALL                                  'Fiber', 'suspend'
         10        ROPE_INIT                                     5  ~10     'Stage+%27'
         11        ROPE_ADD                                      1  ~10     ~10, !2
         12        ROPE_ADD                                      2  ~10     ~10, '%27%3A+step+%27'
         13        ROPE_ADD                                      3  ~10     ~10, !3
         14        ROPE_END                                      4  ~9      ~10, '%27+completed.'
         15        SEND_VAL                                                 ~9
         16        DO_FCALL                                      0          
   14    17      > JMP                                                      ->8
         18    >   FE_FREE                                                  $8
   13    19      > JMP                                                      ->5
         20    >   FE_FREE                                                  $5
   19    21      > RETURN                                                   'Deployment+successful.'
   20    22*       VERIFY_RETURN_TYPE                                       
         23*     > RETURN                                                   null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 4
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 4
Branch analysis from position: 8
Branch analysis from position: 4
filename:       /in/8GI6K
function name:  {closure}
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_STATIC_METHOD_CALL                                  'Fiber', 'suspend'
          1        SEND_VAL                                                 'Monitoring+system+initialized.'
          2        DO_FCALL                                      0          
   25     3      > JMP                                                      ->7
   26     4    >   INIT_STATIC_METHOD_CALL                                  'Fiber', 'suspend'
          5        SEND_VAL                                                 'System+health%3A+OK.'
          6        DO_FCALL                                      0          
   25     7    > > JMPNZ                                                    <true>, ->4
   28     8    >   VERIFY_RETURN_TYPE                                       
          9      > RETURN                                                   null

End of Dynamic Function 1

End of function run

End of class Deployment.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.02 ms | 1006 KiB | 14 Q