3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fiber = new Fiber(function() { $count = 3; echo "Début\n"; while(true) { Fiber::suspend(); // on suspend la fiber echo "Il y a des résultats ?\n"; $count--; if ($count === 0) { return; // On a reçu les résultats, on s'arrête } } }); $fiber->start(); // Initie le traitement do { echo "Faire autre chose\n"; $fiber->resume(); // On relance la fiber } while (!$fiber->isTerminated()); // La fiber s'est terminée echo "Fin\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 7
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/tiap5
function name:  (null)
number of ops:  16
compiled vars:  !0 = $fiber
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $1      'Fiber'
          1        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   13     2        SEND_VAL_EX                                              ~2
    2     3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
   15     5        INIT_METHOD_CALL                                         !0, 'start'
          6        DO_FCALL                                      0          
   17     7    >   ECHO                                                     'Faire+autre+chose%0A'
   18     8        INIT_METHOD_CALL                                         !0, 'resume'
          9        DO_FCALL                                      0          
   19    10        INIT_METHOD_CALL                                         !0, 'isTerminated'
         11        DO_FCALL                                      0  $7      
         12        BOOL_NOT                                         ~8      $7
         13      > JMPNZ                                                    ~8, ->7
   20    14    >   ECHO                                                     'Fin%0A'
         15      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 3
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/tiap5
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $count
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 3
    4     1        ECHO                                                     'D%C3%A9but%0A'
    5     2      > JMP                                                      ->10
    6     3    >   INIT_STATIC_METHOD_CALL                                  'Fiber', 'suspend'
          4        DO_FCALL                                      0          
    7     5        ECHO                                                     'Il+y+a+des+r%C3%A9sultats+%3F%0A'
    8     6        PRE_DEC                                                  !0
    9     7        IS_IDENTICAL                                             !0, 0
          8      > JMPZ                                                     ~4, ->10
   10     9    > > RETURN                                                   null
    5    10    > > JMPNZ                                                    <true>, ->3
   13    11    > > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.43 ms | 996 KiB | 13 Q