3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = <<< EOF <?xml version="1.0" encoding="ISO-8859-1" ?> <datainfo> <origin>NOAA/NOS/CO-OPS</origin> <disclaimer>Disclaimer: These data are based upon the latest information available as of the date of your request, and may differ from the published tide tables. </disclaimer> <producttype> Annual Tide Prediction </producttype> <stationname>Nonopapa, Niihau Island</stationname> <state>HI</state> <stationid>1610367</stationid> <stationtype>Subordinate</stationtype> <referencedToStationName>HONOLULU</referencedToStationName> <referencedToStationId>1612340</referencedToStationId> <HeightOffsetLow>*0.77</HeightOffsetLow> <HeightOffsetHigh>* 0.77</HeightOffsetHigh> <TimeOffsetLow>-11</TimeOffsetLow> <TimeOffsetHigh>-16</TimeOffsetHigh> <BeginDate>20131231 00:00</BeginDate> <EndDate>20141231 23:59</EndDate> <dataUnits>feet(ft) also in centimeters(cm)</dataUnits> <Timezone>LST</Timezone> <Datum>MLLW</Datum> <IntervalType>High/Low Tide Predictions</IntervalType> <data> <item> <date>2013/12/31</date> <day>Tue</day> <time>03:11 AM</time> <predictions_in_ft>2.0</predictions_in_ft> <predictions_in_cm>61</predictions_in_cm> <highlow>H</highlow> </item> <item> <date>2013/12/31</date> <day>Tue</day> <time>10:21 AM</time> <predictions_in_ft>0.1</predictions_in_ft> <predictions_in_cm>3</predictions_in_cm> <highlow>L</highlow> </item> </data></datainfo> EOF; $needToKeep = ['referencedToStationName','referencedToStationId','HeightOffsetLow','HeightOffsetHigh','TimeOffsetLow','TimeOffsetHigh','stationname','stationid','stationtype']; $b = simplexml_load_string($a); $json = json_encode($b ); $array = json_decode($json,true); // unset undesirables foreach($array as $k => $v){ if(!in_array($k, $needToKeep)) unset($array[$k]); }; var_export($array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 26
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 26
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 25
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 25
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/WgXC7
function name:  (null)
number of ops:  31
compiled vars:  !0 = $a, !1 = $needToKeep, !2 = $b, !3 = $json, !4 = $array, !5 = $v, !6 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22ISO-8859-1%22+%3F%3E+%0A%3Cdatainfo%3E%0A%3Corigin%3ENOAA%2FNOS%2FCO-OPS%3C%2Forigin%3E%0A%3Cdisclaimer%3EDisclaimer%3A+These+data+are+based+upon+the+latest+information+available+as+of+the+date+of+your+request%2C+and+may+differ+from+the+published+tide+tables.+%3C%2Fdisclaimer%3E%0A%3Cproducttype%3E+Annual+Tide+Prediction+%3C%2Fproducttype%3E%0A%3Cstationname%3ENonopapa%2C+Niihau+Island%3C%2Fstationname%3E%0A%3Cstate%3EHI%3C%2Fstate%3E%0A%3Cstationid%3E1610367%3C%2Fstationid%3E%0A%3Cstationtype%3ESubordinate%3C%2Fstationtype%3E%0A%3CreferencedToStationName%3EHONOLULU%3C%2FreferencedToStationName%3E%0A%3CreferencedToStationId%3E1612340%3C%2FreferencedToStationId%3E%0A%3CHeightOffsetLow%3E%2A0.77%3C%2FHeightOffsetLow%3E%0A%3CHeightOffsetHigh%3E%2A+0.77%3C%2FHeightOffsetHigh%3E%0A%3CTimeOffsetLow%3E-11%3C%2FTimeOffsetLow%3E%0A%3CTimeOffsetHigh%3E-16%3C%2FTimeOffsetHigh%3E%0A%3CBeginDate%3E20131231+00%3A00%3C%2FBeginDate%3E%0A%3CEndDate%3E20141231+23%3A59%3C%2FEndDate%3E%0A%3CdataUnits%3Efeet%28ft%29+also+in+centimeters%28cm%29%3C%2FdataUnits%3E%0A%3CTimezone%3ELST%3C%2FTimezone%3E%0A%3CDatum%3EMLLW%3C%2FDatum%3E%0A%3CIntervalType%3EHigh%2FLow+Tide+Predictions%3C%2FIntervalType%3E%0A%3Cdata%3E%0A%3Citem%3E%0A%3Cdate%3E2013%2F12%2F31%3C%2Fdate%3E%0A%3Cday%3ETue%3C%2Fday%3E%0A%3Ctime%3E03%3A11+AM%3C%2Ftime%3E%0A%3Cpredictions_in_ft%3E2.0%3C%2Fpredictions_in_ft%3E%0A%3Cpredictions_in_cm%3E61%3C%2Fpredictions_in_cm%3E%0A%3Chighlow%3EH%3C%2Fhighlow%3E%0A%3C%2Fitem%3E%0A%3Citem%3E%0A%3Cdate%3E2013%2F12%2F31%3C%2Fdate%3E%0A%3Cday%3ETue%3C%2Fday%3E%0A%3Ctime%3E10%3A21+AM%3C%2Ftime%3E%0A%3Cpredictions_in_ft%3E0.1%3C%2Fpredictions_in_ft%3E%0A%3Cpredictions_in_cm%3E3%3C%2Fpredictions_in_cm%3E%0A%3Chighlow%3EL%3C%2Fhighlow%3E%0A%3C%2Fitem%3E%0A%3C%2Fdata%3E%3C%2Fdatainfo%3E'
   43     1        ASSIGN                                                   !1, <array>
   45     2        INIT_FCALL                                               'simplexml_load_string'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $9      
          5        ASSIGN                                                   !2, $9
   47     6        INIT_FCALL                                               'json_encode'
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $11     
          9        ASSIGN                                                   !3, $11
   48    10        INIT_FCALL                                               'json_decode'
         11        SEND_VAR                                                 !3
         12        SEND_VAL                                                 <true>
         13        DO_ICALL                                         $13     
         14        ASSIGN                                                   !4, $13
   51    15      > FE_RESET_R                                       $15     !4, ->26
         16    > > FE_FETCH_R                                       ~16     $15, !5, ->26
         17    >   ASSIGN                                                   !6, ~16
   53    18        INIT_FCALL                                               'in_array'
         19        SEND_VAR                                                 !6
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                         $18     
         22        BOOL_NOT                                         ~19     $18
         23      > JMPZ                                                     ~19, ->25
         24    >   UNSET_DIM                                                !4, !6
   51    25    > > JMP                                                      ->16
         26    >   FE_FREE                                                  $15
   57    27        INIT_FCALL                                               'var_export'
         28        SEND_VAR                                                 !4
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.91 ms | 1400 KiB | 23 Q