3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Voer volgende oefeningen uit. Schrijf je code steeds tussen: * //-- start -- en * * //-- stop -- * * Alle geschreven code mag niet worden gewijzigd. Je antwoorden worden automatisch gevalideerd. */ $families = [ ['man' => 'Ignace', 'vrouw' => 'Caroline', 'kinderen' => ['Matteo']], ['man' => 'Bart', 'vrouw' => 'Trees', 'kinderen' => ['Jarno', 'Tibaut', 'Emiel']], ]; // 1. toon alle mannen op het scherm met behulp van een foreach: ob_start(); // -- start -- // -- stop -- toonResultaatOefening(ob_get_clean(), "Ignace\nBart\n"); // 2. toon volgende tekst op het scherm met behulp van een foreach: // // Ignace en Caroline hebben 1 kind(eren) // Bart en Trees hebben 3 kind(eren) // // http://php.net/count -- count() telt het aantal elementen in een array ob_start(); // -- start -- // -- stop -- toonResultaatOefening(ob_get_clean(), "Ignace en Caroline hebben 1 kind(eren)\nBart en Trees hebben 3 kind(eren)\n"); // 3. Verander de waarde van $a, $b of beide zodat onderstaande oefening juist is: // -- start -- $a = false; $b = false; // -- stop -- toonResultaatOefening($a xor $b || $a && $b, true); // -- einde -- function toonResultaatOefening($output, $verwacht) { static $nummer; if (null === $nummer) { $nummer = 1; } else { $nummer += 1; } echo $output, PHP_EOL; echo 'Oefening #', $nummer, ' is ', ($output === $verwacht ? 'juist' : 'fout'), PHP_EOL, PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
2 jumps found. (Code = 46) Position 1 = 22, Position 2 = 23
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
Branch analysis from position: 24
filename:       /in/q0bu5
function name:  (null)
number of ops:  29
compiled vars:  !0 = $families, !1 = $a, !2 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, <array>
   18     1        INIT_FCALL                                               'ob_start'
          2        DO_ICALL                                                 
   26     3        INIT_FCALL_BY_NAME                                       'toonResultaatOefening'
          4        INIT_FCALL                                               'ob_get_clean'
          5        DO_ICALL                                         $5      
          6        SEND_VAR_NO_REF_EX                                       $5
          7        SEND_VAL_EX                                              'Ignace%0ABart%0A'
          8        DO_FCALL                                      0          
   35     9        INIT_FCALL                                               'ob_start'
         10        DO_ICALL                                                 
   43    11        INIT_FCALL_BY_NAME                                       'toonResultaatOefening'
         12        INIT_FCALL                                               'ob_get_clean'
         13        DO_ICALL                                         $8      
         14        SEND_VAR_NO_REF_EX                                       $8
         15        SEND_VAL_EX                                              'Ignace+en+Caroline+hebben+1+kind%28eren%29%0ABart+en+Trees+hebben+3+kind%28eren%29%0A'
         16        DO_FCALL                                      0          
   48    17        ASSIGN                                                   !1, <false>
   49    18        ASSIGN                                                   !2, <false>
   52    19        INIT_FCALL_BY_NAME                                       'toonResultaatOefening'
         20      > JMPNZ_EX                                         ~12     !2, ->24
         21    > > JMPZ_EX                                          ~13     !1, ->23
         22    >   BOOL                                             ~13     !2
         23    >   BOOL                                             ~12     ~13
         24    >   BOOL_XOR                                         ~14     !1, ~12
         25        SEND_VAL_EX                                              ~14
         26        SEND_VAL_EX                                              <true>
         27        DO_FCALL                                      0          
   66    28      > RETURN                                                   1

Function toonresultaatoefening:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
Branch analysis from position: 17
filename:       /in/q0bu5
function name:  toonResultaatOefening
number of ops:  22
compiled vars:  !0 = $output, !1 = $verwacht, !2 = $nummer
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   55     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   56     2        BIND_STATIC                                              !2
   58     3        TYPE_CHECK                                    2          !2
          4      > JMPZ                                                     ~3, ->7
   59     5    >   ASSIGN                                                   !2, 1
   58     6      > JMP                                                      ->8
   61     7    >   ASSIGN_OP                                     1          !2, 1
   64     8    >   ECHO                                                     !0
          9        ECHO                                                     '%0A'
   65    10        ECHO                                                     'Oefening+%23'
         11        ECHO                                                     !2
         12        ECHO                                                     '+is+'
         13        IS_IDENTICAL                                             !0, !1
         14      > JMPZ                                                     ~6, ->17
         15    >   QM_ASSIGN                                        ~7      'juist'
         16      > JMP                                                      ->18
         17    >   QM_ASSIGN                                        ~7      'fout'
         18    >   ECHO                                                     ~7
         19        ECHO                                                     '%0A'
         20        ECHO                                                     '%0A'
   66    21      > RETURN                                                   null

End of function toonresultaatoefening

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.33 ms | 1465 KiB | 15 Q