<?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);
?>
{
"result": {
"anime": [
{
"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"
},
{
"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"
}
],
"Current_page": "1",
"Total_Pages": 75,
"PerPage": 3,
"Total": 224
}
}
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
{
"result": {
"anime": [
{
"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"
},
{
"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"
}
],
"Current_page": "1",
"Total_Pages": 75,
"PerPage": 3,
"Total": 224
}
}
Output for 5.3.0 - 5.3.29
Notice: Use of undefined constant JSON_PRETTY_PRINT - assumed 'JSON_PRETTY_PRINT' in /in/XUBDD on line 50
Warning: json_encode() expects parameter 2 to be long, string given in /in/XUBDD on line 50