3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "This is my string but it also has %APP:name_of_the_app|ID:123123123% a bunch of other stuff in it"; $apps = array(); if (preg_match_all("/%APP:(.*?)\|ID:([0-9]+)%/", $string, $matches)) { for ($i = 0; $i < count($matches[0]); $i++) { $apps[] = array( "name" => $matches[1][$i], "id" => $matches[2][$i] ); } } print_r($apps);

preferences:
36.39 ms | 402 KiB | 5 Q