3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{ "result": { "anime": [ { "rowid": "2", "title": "Dusk Maiden of Amnesia", "pic": "\/\/i.imgur.com\/J4HRnHP.jpg", "slug": "Dusk-Maiden-of-Amnesia-dub", "year": "2012", "status": "done", "descript": "The story revolves around a first-year middle school student, Teiichi Niiya who had just enrolled at Seikyou Private Academy. When he gets lost in one of the schools old buildings, he meets a girl named Yuuko Kanoe who reveals herself as a ghost with no memories. Teiichi then decides to investigate her death by looking through the schools seven mysteries revolving around her. Throughout the story, Teiichi and Yuuko discover the truth about these ghost stories while helping those who are troubled.", "tags": "Mystery,,Romance,,School Club,,School Life,,Supernatural,,High School" }, { "rowid": "12", "title": "Accel World", "pic": "https:\/\/i.imgur.com\/65gNsOX.png", "slug": "Accel-World-dub", "year": "2012", "status": "done", "descript": "Haruyuki+%22Haru%22+Arita+is+a+short%2C+overweight+boy+who+is+frequently+ridiculed+by+delinquents+at+the+Umesato+Junior+High+School.+Using+his+Neuro+Linker+to+escape+the+torment+of+real+life%2C+he+logs+onto+the+school%27s+Local+Network+cyberspace+where+he+always+plays+virtual+squash+alone%2C+and+his+innate+video+game+skills+bring+him+to+the+attention+of+Kuroyukihime+%28literally+meaning+%22Black+Snow+Princess%22%29%2C+the+school%27s+popular%2C+highly+intellectual+and+attractive+female+Student+Council+Vice-President.++After+helping+him+against+the+delinquents%2C+Kuroyukihime+introduces+Haruyuki+to+Brain+Burst%2C+a+secret+program+that+is+able+to+accelerate+the+human+cognitive+process+to+the+point+at+which+time+appears+to+stop.+Haruyuki+soon+learns+that+Brain+Burst+is+more+than+just+a+program%2C+but+an+Augmented+Reality+Massively+Multiplayer+Online+%28ARMMO%29+Fighting+Game+where+people+fight+each+other+in+fierce+duels+in+order+to+obtain+Burst+Points+which+can+be+spent+for+acceleration+abilities+in+the+real+world.", "tags": "Action,,Sci Fi,,Based On A Light Novel,,Futuristic,,Virtual Reality" }, { "rowid": "7", "title": "Parasyte the maxim", "pic": "https:\/\/i.imgur.com\/AY7WkqY.jpg", "slug": "Parasyte-the-maxim-dub", "year": "2014", "status": "done", "descript": "17-year-old+Izumi+Shinichi+lives+with+his+mother+and+father+in+a+quiet+neighborhood+in+Tokyo.+One+night%2C+worm-like+aliens+called+Parasytes+invade+Earth%2C+taking+over+the+brains+of+human+hosts+by+entering+through+their+ears+or+noses.+One+Parasyte+attempts+to+crawl+into+Shinichi%27s+ear+while+he+sleeps%2C+but+fails+since+he+is+wearing+headphones%2C+and+enters+his+body+by+burrowing+into+his+arm+instead%2C+taking+over+his+right+hand+and+is+named+Migi.+Because+Shinichi+was+able+to+prevent+Migi+from+traveling+further+up+into+his+brain%2C+both+beings+retain+their+separate+intellect+and+personality.+As+the+duo+encounter+other+Parasytes%2C+they+capitalize+on+their+strange+situation+and+gradually+form+a+strong+bond%2C+working+together+to+survive.+This+gives+them+an+edge+in+battling+other+Parasytes%2C+who+frequently+attack+the+pair+upon+realization+that+Shinichi%27s+human+brain+is+still+intact.+Shinichi+feels+compelled+to+fight+other+Parasytes%2C+who+devour+humans+as+food%2C+while+enlisting+Migi%27s+help.", "tags": "Action,,Horror,,Sci Fi,,Aliens,,Body Sharing,,Bullying,,Explicit Violence,,Psychological" } ], "Current_page": "1", "Total_Pages": 75, "PerPage": 3, "Total": 224 } }'; $userInput = "maxim"; $jsonf = json_decode($json, true); usort($jsonf['result']['anime'], function ($a, $b) use ($userInput) { similar_text($userInput, $a['title'], $percentA); similar_text($userInput, $b['title'], $percentB); return $percentA === $percentB ? 0 : ($percentA > $percentB ? -1 : 1); }); echo json_encode($jsonf, JSON_PRETTY_PRINT); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XUBDD
function name:  (null)
number of ops:  21
compiled vars:  !0 = $json, !1 = $userInput, !2 = $jsonf
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%7B%0A++++%22result%22%3A+%7B%0A++++++++%22anime%22%3A+%5B%0A++++++++++++%7B%0A++++++++++++++++%22rowid%22%3A+%222%22%2C%0A++++++++++++++++%22title%22%3A+%22Dusk+Maiden+of+Amnesia%22%2C%0A++++++++++++++++%22pic%22%3A+%22%5C%2F%5C%2Fi.imgur.com%5C%2FJ4HRnHP.jpg%22%2C%0A++++++++++++++++%22slug%22%3A+%22Dusk-Maiden-of-Amnesia-dub%22%2C%0A++++++++++++++++%22year%22%3A+%222012%22%2C%0A++++++++++++++++%22status%22%3A+%22done%22%2C%0A++++++++++++++++%22descript%22%3A+%22The+story+revolves+around+a+first-year+middle+school+student%2C+Teiichi+Niiya+who+had+just+enrolled+at+Seikyou+Private+Academy.+When+he+gets+lost+in+one+of+the+schools+old+buildings%2C+he+meets+a+girl+named+Yuuko+Kanoe+who+reveals+herself+as+a+ghost+with+no+memories.+Teiichi+then+decides+to+investigate+her+death+by+looking+through+the+schools+seven+mysteries+revolving+around+her.+Throughout+the+story%2C+Teiichi+and+Yuuko+discover+the+truth+about+these+ghost+stories+while+helping+those+who+are+troubled.%22%2C%0A++++++++++++++++%22tags%22%3A+%22Mystery%2C%2CRomance%2C%2CSchool+Club%2C%2CSchool+Life%2C%2CSupernatural%2C%2CHigh+School%22%0A++++++++++++%7D%2C%0A++++++++++++%7B%0A++++++++++++++++%22rowid%22%3A+%2212%22%2C%0A++++++++++++++++%22title%22%3A+%22Accel+World%22%2C%0A++++++++++++++++%22pic%22%3A+%22https%3A%5C%2F%5C%2Fi.imgur.com%5C%2F65gNsOX.png%22%2C%0A++++++++++++++++%22slug%22%3A+%22Accel-World-dub%22%2C%0A++++++++++++++++%22year%22%3A+%222012%22%2C%0A++++++++++++++++%22status%22%3A+%22done%22%2C%0A++++++++++++++++%22descript%22%3A+%22Haruyuki%2B%2522Haru%2522%2BArita%2Bis%2Ba%2Bshort%252C%2Boverweight%2Bboy%2Bwho%2Bis%2Bfrequently%2Bridiculed%2Bby%2Bdelinquents%2Bat%2Bthe%2BUmesato%2BJunior%2BHigh%2BSchool.%2BUsing%2Bhis%2BNeuro%2BLinker%2Bto%2Bescape%2Bthe%2Btorment%2Bof%2Breal%2Blife%252C%2Bhe%2Blogs%2Bonto%2Bthe%2Bschool%2527s%2BLocal%2BNetwork%2Bcyberspace%2Bwhere%2Bhe%2Balways%2Bplays%2Bvirtual%2Bsquash%2Balone%252C%2Band%2Bhis%2Binnate%2Bvideo%2Bgame%2Bskills%2Bbring%2Bhim%2Bto%2Bthe%2Battention%2Bof%2BKuroyukihime%2B%2528literally%2Bmeaning%2B%2522Black%2BSnow%2BPrincess%2522%2529%252C%2Bthe%2Bschool%2527s%2Bpopular%252C%2Bhighly%2Bintellectual%2Band%2Battractive%2Bfemale%2BStudent%2BCouncil%2BVice-President.%2B%2BAfter%2Bhelping%2Bhim%2Bagainst%2Bthe%2Bdelinquents%252C%2BKuroyukihime%2Bintroduces%2BHaruyuki%2Bto%2BBrain%2BBurst%252C%2Ba%2Bsecret%2Bprogram%2Bthat%2Bis%2Bable%2Bto%2Baccelerate%2Bthe%2Bhuman%2Bcognitive%2Bprocess%2Bto%2Bthe%2Bpoint%2Bat%2Bwhich%2Btime%2Bappears%2Bto%2Bstop.%2BHaruyuki%2Bsoon%2Blearns%2Bthat%2BBrain%2BBurst%2Bis%2Bmore%2Bthan%2Bjust%2Ba%2Bprogram%252C%2Bbut%2Ban%2BAugmented%2BReality%2BMassively%2BMultiplayer%2BOnline%2B%2528ARMMO%2529%2BFighting%2BGame%2Bwhere%2Bpeople%2Bfight%2Beach%2Bother%2Bin%2Bfierce%2Bduels%2Bin%2Border%2Bto%2Bobtain%2BBurst%2BPoints%2Bwhich%2Bcan%2Bbe%2Bspent%2Bfor%2Bacceleration%2Babilities%2Bin%2Bthe%2Breal%2Bworld.%22%2C%0A++++++++++++++++%22tags%22%3A+%22Action%2C%2CSci+Fi%2C%2CBased+On+A+Light+Novel%2C%2CFuturistic%2C%2CVirtual+Reality%22%0A++++++++++++%7D%2C%0A++++++++++++%7B%0A++++++++++++++++%22rowid%22%3A+%227%22%2C%0A++++++++++++++++%22title%22%3A+%22Parasyte+the+maxim%22%2C%0A++++++++++++++++%22pic%22%3A+%22https%3A%5C%2F%5C%2Fi.imgur.com%5C%2FAY7WkqY.jpg%22%2C%0A++++++++++++++++%22slug%22%3A+%22Parasyte-the-maxim-dub%22%2C%0A++++++++++++++++%22year%22%3A+%222014%22%2C%0A++++++++++++++++%22status%22%3A+%22done%22%2C%0A++++++++++++++++%22descript%22%3A+%2217-year-old%2BIzumi%2BShinichi%2Blives%2Bwith%2Bhis%2Bmother%2Band%2Bfather%2Bin%2Ba%2Bquiet%2Bneighborhood%2Bin%2BTokyo.%2BOne%2Bnight%252C%2Bworm-like%2Baliens%2Bcalled%2BParasytes%2Binvade%2BEarth%252C%2Btaking%2Bover%2Bthe%2Bbrains%2Bof%2Bhuman%2Bhosts%2Bby%2Bentering%2Bthrough%2Btheir%2Bears%2Bor%2Bnoses.%2BOne%2BParasyte%2Battempts%2Bto%2Bcrawl%2Binto%2BShinichi%2527s%2Bear%2Bwhile%2Bhe%2Bsleeps%252C%2Bbut%2Bfails%2Bsince%2Bhe%2Bis%2Bwearing%2Bheadphones%252C%2Band%2Benters%2Bhis%2Bbody%2Bby%2Bburrowing%2Binto%2Bhis%2Barm%2Binstead%252C%2Btaking%2Bover%2Bhis%2Bright%2Bhand%2Band%2Bis%2Bnamed%2BMigi.%2BBecause%2BShinichi%2Bwas%2Bable%2Bto%2Bprevent%2BMigi%2Bfrom%2Btraveling%2Bfurther%2Bup%2Binto%2Bhis%2Bbrain%252C%2Bboth%2Bbeings%2Bretain%2Btheir%2Bseparate%2Bintellect%2Band%2Bpersonality.%2BAs%2Bthe%2Bduo%2Bencounter%2Bother%2BParasytes%252C%2Bthey%2Bcapitalize%2Bon%2Btheir%2Bstrange%2Bsituation%2Band%2Bgradually%2Bform%2Ba%2Bstrong%2Bbond%252C%2Bworking%2Btogether%2Bto%2Bsurvive.%2BThis%2Bgives%2Bthem%2Ban%2Bedge%2Bin%2Bbattling%2Bother%2BParasytes%252C%2Bwho%2Bfrequently%2Battack%2Bthe%2Bpair%2Bupon%2Brealization%2Bthat%2BShinichi%2527s%2Bhuman%2Bbrain%2Bis%2Bstill%2Bintact.%2BShinichi%2Bfeels%2Bcompelled%2Bto%2Bfight%2Bother%2BParasytes%252C%2Bwho%2Bdevour%2Bhumans%2Bas%2Bfood%252C%2Bwhile%2Benlisting%2BMigi%2527s%2Bhelp.%22%2C%0A++++++++++++++++%22tags%22%3A+%22Action%2C%2CHorror%2C%2CSci+Fi%2C%2CAliens%2C%2CBody+Sharing%2C%2CBullying%2C%2CExplicit+Violence%2C%2CPsychological%22%0A++++++++++++%7D%0A++++++++%5D%2C%0A++++++++%22Current_page%22%3A+%221%22%2C%0A++++++++%22Total_Pages%22%3A+75%2C%0A++++++++%22PerPage%22%3A+3%2C%0A++++++++%22Total%22%3A+224%0A++++%7D%0A%7D'
   42     1        ASSIGN                                                   !1, 'maxim'
   43     2        INIT_FCALL                                               'json_decode'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !2, $5
   44     7        INIT_FCALL                                               'usort'
          8        FETCH_DIM_W                                      $7      !2, 'result'
          9        FETCH_DIM_W                                      $8      $7, 'anime'
         10        SEND_REF                                                 $8
         11        DECLARE_LAMBDA_FUNCTION                          ~9      [0]
         12        BIND_LEXICAL                                             ~9, !1
   49    13        SEND_VAL                                                 ~9
   44    14        DO_ICALL                                                 
   50    15        INIT_FCALL                                               'json_encode'
         16        SEND_VAR                                                 !2
         17        SEND_VAL                                                 128
         18        DO_ICALL                                         $11     
         19        ECHO                                                     $11
   51    20      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XUBDD
function name:  {closure}
number of ops:  27
compiled vars:  !0 = $a, !1 = $b, !2 = $userInput, !3 = $percentA, !4 = $percentB
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   45     3        INIT_FCALL                                               'similar_text'
          4        SEND_VAR                                                 !2
          5        FETCH_DIM_R                                      ~5      !0, 'title'
          6        SEND_VAL                                                 ~5
          7        SEND_REF                                                 !3
          8        DO_ICALL                                                 
   46     9        INIT_FCALL                                               'similar_text'
         10        SEND_VAR                                                 !2
         11        FETCH_DIM_R                                      ~7      !1, 'title'
         12        SEND_VAL                                                 ~7
         13        SEND_REF                                                 !4
         14        DO_ICALL                                                 
   48    15        IS_IDENTICAL                                             !3, !4
         16      > JMPZ                                                     ~9, ->19
         17    >   QM_ASSIGN                                        ~10     0
         18      > JMP                                                      ->25
         19    >   IS_SMALLER                                               !4, !3
         20      > JMPZ                                                     ~11, ->23
         21    >   QM_ASSIGN                                        ~12     -1
         22      > JMP                                                      ->24
         23    >   QM_ASSIGN                                        ~12     1
         24    >   QM_ASSIGN                                        ~10     ~12
         25    > > RETURN                                                   ~10
   49    26*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
240.44 ms | 1010 KiB | 17 Q