3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @xmlNamespace http://www.webservices.nl/soap/ * @xmlType * @xmlName RiskAddress */ class Address { /** * @xmlType string * @xmlRender value * @xmlName postcode * @xmlNamespace http://www.webservices.nl/soap/ */ protected $_postcode; /** * @xmlType string * @xmlRender value * @xmlName building * @xmlNamespace http://www.webservices.nl/soap/ */ protected $_building; /** * @xmlType string * @xmlRender value * @xmlName street * @xmlNamespace http://www.webservices.nl/soap/ */ protected $_street; /** * @xmlType integer * @xmlRender value * @xmlName house_number * @xmlNamespace http://www.webservices.nl/soap/ */ protected $_house_number; /** * @xmlType string * @xmlRender value * @xmlName house_number_addition * @xmlNamespace http://www.webservices.nl/soap/ */ protected $_house_number_addition; /** * @xmlType string * @xmlRender value * @xmlName city * @xmlNamespace http://www.webservices.nl/soap/ */ protected $_city; /** * @xmlType string * @xmlRender value * @xmlName municipality * @xmlNamespace http://www.webservices.nl/soap/ */ protected $_municipality; /** * @xmlType string * @xmlRender value * @xmlName state * @xmlNamespace http://www.webservices.nl/soap/ */ protected $_state; /** * @xmlType string * @xmlRender value * @xmlName country * @xmlNamespace http://www.webservices.nl/soap/ */ protected $_country; /** * @return string */ public function getPostcode() { return $this->_postcode; } /** * @param string $postcode */ public function setPostcode($postcode) { $this->_postcode = (string) $postcode; } /** * @return string */ public function getBuilding() { return $this->_building; } /** * @param string $building */ public function setBuilding($building) { $this->_building = (string) $building; } /** * @return string */ public function getStreet() { return $this->_street; } /** * @param string $street */ public function setStreet($street) { $this->_street = (string) $street; } /** * @return integer */ public function getHouseNumber() { return $this->_house_number; } /** * @param (integer) $houseNumber */ public function setHouseNumber($houseNumber) { $this->_house_number = (integer) $houseNumber; } /** * @return string */ public function getHouseNumberAddition() { return $this->_house_number_addition; } /** * @param string $houseNumberAddition */ public function setHouseNumberAddition($houseNumberAddition) { $this->_house_number_addition = (string) $houseNumberAddition; } /** * @return string */ public function getCity() { return $this->_city; } /** * @param string $city */ public function setCity($city) { $this->_city = (string) $city; } /** * @return string */ public function getMunicipality() { return $this->_municipality; } /** * @param string $municipality */ public function setMunicipality($municipality) { $this->_municipality = $municipality; } /** * @return string */ public function getState() { return $this->_state; } /** * @param string $state */ public function setState($state) { $this->_state = (string) $state; } /** * @return string */ public function getCountry() { return $this->_country; } /** * @param string $country */ public function setCountry($country) { $this->_country = (string) $country; } } class AddressHelper { public static function parse(Address $address, $parts) { $parts = func_get_args(); $address = array_shift($parts); $format = '~^(.*?\n)??' . '(?<street>[^0-9].*|.*?[^0-9])[\b\s]*?' . '(?<number>[0-9]{1,5}?)[\b\s\-]*?' . '(?<addition>[^\s]*?)[\b\s,]*?' . '(?<postcode>[0-9]{4}\s?[A-Z]{2})[\b\s,]*?' . '(?<city>[\w][\w\s]*?)' . '(\n.*)??$~msiU'; if (preg_match($format, implode(PHP_EOL, $parts), $args)) { $street = $number = $postcode = $city = $addition = null; extract($args, EXTR_OVERWRITE); $address->setStreet($street); $address->setHouseNumber($number); $address->setHouseNumberAddition($addition); $address->setPostcode($postcode); $address->setCity(strtoupper(trim($city))); } return $address; } } echo AddressHelper::parse(new Address(), null, null, null, null, null);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6bPc
function name:  (null)
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  262     0  E >   INIT_STATIC_METHOD_CALL                                  'AddressHelper', 'parse'
          1        NEW                                              $0      'Address'
          2        DO_FCALL                                      0          
          3        SEND_VAR                                                 $0
          4        SEND_VAL                                                 null
          5        SEND_VAL                                                 null
          6        SEND_VAL                                                 null
          7        SEND_VAL                                                 null
          8        SEND_VAL                                                 null
          9        DO_FCALL                                      0  $2      
         10        ECHO                                                     $2
         11      > RETURN                                                   1

Class Address:
Function getpostcode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6bPc
function name:  getPostcode
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   88     0  E >   FETCH_OBJ_R                                      ~0      '_postcode'
          1      > RETURN                                                   ~0
   89     2*     > RETURN                                                   null

End of function getpostcode

Function setpostcode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6bPc
function name:  setPostcode
number of ops:  5
compiled vars:  !0 = $postcode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   94     0  E >   RECV                                             !0      
   96     1        CAST                                          6  ~2      !0
          2        ASSIGN_OBJ                                               '_postcode'
          3        OP_DATA                                                  ~2
   97     4      > RETURN                                                   null

End of function setpostcode

Function getbuilding:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6bPc
function name:  getBuilding
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  104     0  E >   FETCH_OBJ_R                                      ~0      '_building'
          1      > RETURN                                                   ~0
  105     2*     > RETURN                                                   null

End of function getbuilding

Function setbuilding:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6bPc
function name:  setBuilding
number of ops:  5
compiled vars:  !0 = $building
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  110     0  E >   RECV                                             !0      
  112     1        CAST                                          6  ~2      !0
          2        ASSIGN_OBJ                                               '_building'
          3        OP_DATA                                                  ~2
  113     4      > RETURN                                                   null

End of function setbuilding

Function getstreet:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6bPc
function name:  getStreet
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  120     0  E >   FETCH_OBJ_R                                      ~0      '_street'
          1      > RETURN                                                   ~0
  121     2*     > RETURN                                                   null

End of function getstreet

Function setstreet:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6bPc
function name:  setStreet
number of ops:  5
compiled vars:  !0 = $street
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  126     0  E >   RECV                                             !0      
  128     1        CAST                                          6  ~2      !0
          2        ASSIGN_OBJ                                               '_street'
          3        OP_DATA                                                  ~2
  129     4      > RETURN                                                   null

End of function setstreet

Function gethousenumber:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6bPc
function name:  getHouseNumber
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  136     0  E >   FETCH_OBJ_R                                      ~0      '_house_number'
          1      > RETURN                                                   ~0
  137     2*     > RETURN                                                   null

End of function gethousenumber

Function sethousenumber:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6bPc
function name:  setHouseNumber
number of ops:  5
compiled vars:  !0 = $houseNumber
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  142     0  E >   RECV                                             !0      
  144     1        CAST                                          4  ~2      !0
          2        ASSIGN_OBJ                                               '_house_number'
          3        OP_DATA                                                  ~2
  145     4      > RETURN                                                   null

End of function sethousenumber

Function gethousenumberaddition:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6bPc
function name:  getHouseNumberAddition
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  152     0  E >   FETCH_OBJ_R                                      ~0      '_house_number_addition'
          1      > RETURN                                                   ~0
  153     2*     > RETURN                                                   null

End of function gethousenumberaddition

Function sethousenumberaddition:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6bPc
function name:  setHouseNumberAddition
number of ops:  5
compiled vars:  !0 = $houseNumberAddition
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  158     0  E >   RECV                                             !0      
  160     1        CAST                                          6  ~2      !0
          2        ASSIGN_OBJ                                               '_house_number_addition'
          3        OP_DATA                                                  ~2
  161     4      > RETURN                                                   null

End of function sethousenumberaddition

Function getcity:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6bPc
function name:  getCity
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  168     0  E >   FETCH_OBJ_R                                      ~0      '_city'
          1      > RETURN                                                   ~0
  169     2*     > RETURN                                                   null

End of function getcity

Function setcity:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6bPc
function name:  setCity
number of ops:  5
compiled vars:  !0 = $city
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  174     0  E >   RECV                                             !0      
  176     1        CAST                                          6  ~2      !0
          2        ASSIGN_OBJ                                               '_city'
          3        OP_DATA                                                  ~2
  177     4      > RETURN                                                   null

End of function setcity

Function getmunicipality:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6bPc
function name:  getMunicipality
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  184     0  E >   FETCH_OBJ_R                                      ~0      '_municipality'
          1      > RETURN                                                   ~0
  185     2*     > RETURN                                                   null

End of function getmunicipality

Function setmunicipality:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6bPc
function name:  setMunicipality
number of ops:  4
compiled vars:  !0 = $municipality
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  190     0  E >   RECV                                             !0      
  192     1        ASSIGN_OBJ                                               '_municipality'
          2        OP_DATA                                                  !0
  193     3      > RETURN                                                   null

End of function setmunicipality

Function getstate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6bPc
function name:  getState
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  200     0  E >   FETCH_OBJ_R                                      ~0      '_state'
          1      > RETURN                                                   ~0
  201     2*     > RETURN                                                   null

End of function getstate

Function setstate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6bPc
function name:  setState
number of ops:  5
compiled vars:  !0 = $state
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  206     0  E >   RECV                                             !0      
  208     1        CAST                                          6  ~2      !0
          2        ASSIGN_OBJ                                               '_state'
          3        OP_DATA                                                  ~2
  209     4      > RETURN                                                   null

End of function setstate

Function getcountry:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6bPc
function name:  getCountry
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  216     0  E >   FETCH_OBJ_R                                      ~0      '_country'
          1      > RETURN                                                   ~0
  217     2*     > RETURN                                                   null

End of function getcountry

Function setcountry:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s6bPc
function name:  setCountry
number of ops:  5
compiled vars:  !0 = $country
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  222     0  E >   RECV                                             !0      
  224     1        CAST                                          6  ~2      !0
          2        ASSIGN_OBJ                                               '_country'
          3        OP_DATA                                                  ~2
  225     4      > RETURN                                                   null

End of function setcountry

End of class Address.

Class AddressHelper:
Function parse:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 49
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
filename:       /in/s6bPc
function name:  parse
number of ops:  51
compiled vars:  !0 = $address, !1 = $parts, !2 = $format, !3 = $args, !4 = $street, !5 = $number, !6 = $postcode, !7 = $city, !8 = $addition
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  232     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  234     2        FUNC_GET_ARGS                                    ~9      
          3        ASSIGN                                                   !1, ~9
  235     4        INIT_FCALL                                               'array_shift'
          5        SEND_REF                                                 !1
          6        DO_ICALL                                         $11     
          7        ASSIGN                                                   !0, $11
  237     8        ASSIGN                                                   !2, '%7E%5E%28.%2A%3F%5Cn%29%3F%3F%28%3F%3Cstreet%3E%5B%5E0-9%5D.%2A%7C.%2A%3F%5B%5E0-9%5D%29%5B%5Cb%5Cs%5D%2A%3F%28%3F%3Cnumber%3E%5B0-9%5D%7B1%2C5%7D%3F%29%5B%5Cb%5Cs%5C-%5D%2A%3F%28%3F%3Caddition%3E%5B%5E%5Cs%5D%2A%3F%29%5B%5Cb%5Cs%2C%5D%2A%3F%28%3F%3Cpostcode%3E%5B0-9%5D%7B4%7D%5Cs%3F%5BA-Z%5D%7B2%7D%29%5B%5Cb%5Cs%2C%5D%2A%3F%28%3F%3Ccity%3E%5B%5Cw%5D%5B%5Cw%5Cs%5D%2A%3F%29%28%5Cn.%2A%29%3F%3F%24%7EmsiU'
  245     9        INIT_FCALL                                               'preg_match'
         10        SEND_VAR                                                 !2
         11        INIT_FCALL                                               'implode'
         12        SEND_VAL                                                 '%0A'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $14     
         15        SEND_VAR                                                 $14
         16        SEND_REF                                                 !3
         17        DO_ICALL                                         $15     
         18      > JMPZ                                                     $15, ->49
  247    19    >   ASSIGN                                           ~16     !8, null
         20        ASSIGN                                           ~17     !7, ~16
         21        ASSIGN                                           ~18     !6, ~17
         22        ASSIGN                                           ~19     !5, ~18
         23        ASSIGN                                                   !4, ~19
  249    24        INIT_FCALL                                               'extract'
         25        SEND_REF                                                 !3
         26        SEND_VAL                                                 0
         27        DO_ICALL                                                 
  251    28        INIT_METHOD_CALL                                         !0, 'setStreet'
         29        SEND_VAR_EX                                              !4
         30        DO_FCALL                                      0          
  252    31        INIT_METHOD_CALL                                         !0, 'setHouseNumber'
         32        SEND_VAR_EX                                              !5
         33        DO_FCALL                                      0          
  253    34        INIT_METHOD_CALL                                         !0, 'setHouseNumberAddition'
         35        SEND_VAR_EX                                              !8
         36        DO_FCALL                                      0          
  254    37        INIT_METHOD_CALL                                         !0, 'setPostcode'
         38        SEND_VAR_EX                                              !6
         39        DO_FCALL                                      0          
  255    40        INIT_METHOD_CALL                                         !0, 'setCity'
         41        INIT_FCALL                                               'strtoupper'
         42        INIT_FCALL                                               'trim'
         43        SEND_VAR                                                 !7
         44        DO_ICALL                                         $26     
         45        SEND_VAR                                                 $26
         46        DO_ICALL                                         $27     
         47        SEND_VAR_NO_REF_EX                                       $27
         48        DO_FCALL                                      0          
  258    49    > > RETURN                                                   !0
  259    50*     > RETURN                                                   null

End of function parse

End of class AddressHelper.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.66 ms | 1412 KiB | 25 Q