3v4l.org

run code in 300+ PHP versions simultaneously
<?php function checaClientePorto($cnpj, $codigoProduto=0) { if (strlen(trim($cnpj))>0) { # $filename = "https://wwws.portoseguro.com.br/ConsultaDadoSeguradoService/REST/obterDadosSegurado?cpfcnpj=$cnpj&codigoProduto=$codigoProduto"; try { $result = simplexml_load_string('segurado> <nomeSegurado>EMERSON DA SILVA BRULL</nomeSegurado> <numeroCpfCnpj>345769118</numeroCpfCnpj> <ordemCnpj>0</ordemCnpj> <digitoCpfCnpj>56</digitoCpfCnpj> <statusSegurado>2</statusSegurado> <corretores> <susep></susep> <susep>V2064F</susep> <susep>P5005J</susep> <susep>P2371J</susep> </corretores> </segurado>'); $obj = json_decode(json_encode((array) $result)); $corretores = get_object_vars($obj->corretores); $retorno = null; if (is_array($corretores['susep'])) { foreach($result['susep'] as $susep) { if( !($susep instanceof stdClass) ) { $retorno = $susep; break; } } } else { $retorno = $result->corretores->susep; } if (is_null($retorno)) { $retorno=''; } //registrarLog(0, 0, 'Retorno Webservice: ' . $retorno); return $retorno; } catch (Exception $e) { return array("erro"=>$e->getMessage()); } } else { return 'ERROCPF'; } } $cpf ='34576911856'; echo "CPF: $cpf<br/>"; $res=checaClientePorto($cpf); print('<pre>Susep Retornado: '.$res.'</pre>'); echo "https://wwws.portoseguro.com.br/ConsultaDadoSeguradoService/REST/obterDadosSegurado?cpfcnpj=$cpf&codigoProduto=0";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/54UCt
function name:  (null)
number of ops:  17
compiled vars:  !0 = $cpf, !1 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   62     0  E >   ASSIGN                                                   !0, '34576911856'
   63     1        ROPE_INIT                                     3  ~4      'CPF%3A+'
          2        ROPE_ADD                                      1  ~4      ~4, !0
          3        ROPE_END                                      2  ~3      ~4, '%3Cbr%2F%3E'
          4        ECHO                                                     ~3
   64     5        INIT_FCALL                                               'checaclienteporto'
          6        SEND_VAR                                                 !0
          7        DO_FCALL                                      0  $6      
          8        ASSIGN                                                   !1, $6
   65     9        CONCAT                                           ~8      '%3Cpre%3ESusep+Retornado%3A+', !1
         10        CONCAT                                           ~9      ~8, '%3C%2Fpre%3E'
         11        ECHO                                                     ~9
   66    12        ROPE_INIT                                     3  ~11     'https%3A%2F%2Fwwws.portoseguro.com.br%2FConsultaDadoSeguradoService%2FREST%2FobterDadosSegurado%3Fcpfcnpj%3D'
         13        ROPE_ADD                                      1  ~11     ~11, !0
         14        ROPE_END                                      2  ~10     ~11, '%26codigoProduto%3D0'
         15        ECHO                                                     ~10
         16      > RETURN                                                   1

Function checaclienteporto:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 54
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 40
Branch analysis from position: 29
2 jumps found. (Code = 77) Position 1 = 31, Position 2 = 38
Branch analysis from position: 31
2 jumps found. (Code = 78) Position 1 = 32, Position 2 = 38
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 37
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 45, Position 2 = 46
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 38
Branch analysis from position: 38
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 45, Position 2 = 46
Branch analysis from position: 45
Branch analysis from position: 46
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 48
Branch analysis from position: 48
2 jumps found. (Code = 107) Position 1 = 49, Position 2 = -2
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/54UCt
function name:  checaClientePorto
number of ops:  56
compiled vars:  !0 = $cnpj, !1 = $codigoProduto, !2 = $result, !3 = $obj, !4 = $corretores, !5 = $retorno, !6 = $susep, !7 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      0
    5     2        INIT_FCALL                                               'trim'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $8      
          5        STRLEN                                           ~9      $8
          6        IS_SMALLER                                               0, ~9
          7      > JMPZ                                                     ~10, ->54
    9     8    >   INIT_FCALL                                               'simplexml_load_string'
          9        SEND_VAL                                                 'segurado%3E%0A%3CnomeSegurado%3EEMERSON+DA+SILVA+BRULL%3C%2FnomeSegurado%3E%0A%3CnumeroCpfCnpj%3E345769118%3C%2FnumeroCpfCnpj%3E%0A%3CordemCnpj%3E0%3C%2FordemCnpj%3E%0A%3CdigitoCpfCnpj%3E56%3C%2FdigitoCpfCnpj%3E%0A%3CstatusSegurado%3E2%3C%2FstatusSegurado%3E%0A%3Ccorretores%3E%0A%3Csusep%3E%3C%2Fsusep%3E%0A%3Csusep%3EV2064F%3C%2Fsusep%3E%0A%3Csusep%3EP5005J%3C%2Fsusep%3E%0A%3Csusep%3EP2371J%3C%2Fsusep%3E%0A%3C%2Fcorretores%3E%0A%3C%2Fsegurado%3E'
         10        DO_ICALL                                         $11     
         11        ASSIGN                                                   !2, $11
   23    12        INIT_FCALL                                               'json_decode'
         13        INIT_FCALL                                               'json_encode'
         14        CAST                                          7  ~13     !2
         15        SEND_VAL                                                 ~13
         16        DO_ICALL                                         $14     
         17        SEND_VAR                                                 $14
         18        DO_ICALL                                         $15     
         19        ASSIGN                                                   !3, $15
   24    20        INIT_FCALL                                               'get_object_vars'
         21        FETCH_OBJ_R                                      ~17     !3, 'corretores'
         22        SEND_VAL                                                 ~17
         23        DO_ICALL                                         $18     
         24        ASSIGN                                                   !4, $18
   26    25        ASSIGN                                                   !5, null
   28    26        FETCH_DIM_R                                      ~21     !4, 'susep'
         27        TYPE_CHECK                                  128          ~21
         28      > JMPZ                                                     ~22, ->40
   29    29    >   FETCH_DIM_R                                      ~23     !2, 'susep'
         30      > FE_RESET_R                                       $24     ~23, ->38
         31    > > FE_FETCH_R                                               $24, !6, ->38
   31    32    >   INSTANCEOF                                       ~25     !6, 'stdClass'
         33        BOOL_NOT                                         ~26     ~25
         34      > JMPZ                                                     ~26, ->37
   32    35    >   ASSIGN                                                   !5, !6
   33    36      > JMP                                                      ->38
   29    37    > > JMP                                                      ->31
         38    >   FE_FREE                                                  $24
         39      > JMP                                                      ->43
   40    40    >   FETCH_OBJ_R                                      ~28     !2, 'corretores'
         41        FETCH_OBJ_R                                      ~29     ~28, 'susep'
         42        ASSIGN                                                   !5, ~29
   43    43    >   TYPE_CHECK                                    2          !5
         44      > JMPZ                                                     ~31, ->46
   45    45    >   ASSIGN                                                   !5, ''
   48    46    > > RETURN                                                   !5
         47*       JMP                                                      ->53
   50    48  E > > CATCH                                       last         'Exception'
   52    49    >   INIT_METHOD_CALL                                         !7, 'getMessage'
         50        DO_FCALL                                      0  $33     
         51        INIT_ARRAY                                       ~34     $33, 'erro'
         52      > RETURN                                                   ~34
         53*       JMP                                                      ->55
   57    54    > > RETURN                                                   'ERROCPF'
   59    55*     > RETURN                                                   null

End of function checaclienteporto

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.74 ms | 1407 KiB | 24 Q