3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isProvider($url) { $providers = array("delfi.lt", "lrytas.lt", "15min.lt"); $provider = 'Unknown'; foreach ($providers as $knownProvider) { // this is quite lazy - it would be best to get the domain and check it against the array of known providers $provider = (stripos($url, $knownProvider) === false ? $provider : $knownProvider); } return $provider; } echo isProvider("http://www.lrytas.lt/lietuvos-diena/aktualijos/nuteistas-v-uspaskichas-sianakt-isskrenda-i-rusija.htm");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hjcvI
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'isprovider'
          1        SEND_VAL                                                 'http%3A%2F%2Fwww.lrytas.lt%2Flietuvos-diena%2Faktualijos%2Fnuteistas-v-uspaskichas-sianakt-isskrenda-i-rusija.htm'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function isprovider:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 16
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 16
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/hjcvI
function name:  isProvider
number of ops:  19
compiled vars:  !0 = $url, !1 = $providers, !2 = $provider, !3 = $knownProvider
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, 'Unknown'
    6     3      > FE_RESET_R                                       $6      !1, ->16
          4    > > FE_FETCH_R                                               $6, !3, ->16
    9     5    >   INIT_FCALL                                               'stripos'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !3
          8        DO_ICALL                                         $7      
          9        TYPE_CHECK                                    4          $7
         10      > JMPZ                                                     ~8, ->13
         11    >   QM_ASSIGN                                        ~9      !2
         12      > JMP                                                      ->14
         13    >   QM_ASSIGN                                        ~9      !3
         14    >   ASSIGN                                                   !2, ~9
    6    15      > JMP                                                      ->4
         16    >   FE_FREE                                                  $6
   11    17      > RETURN                                                   !2
   12    18*     > RETURN                                                   null

End of function isprovider

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.77 ms | 1390 KiB | 16 Q