3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = 'S1G5AB'; // given this $store = '5I6GAB'; // actually this $regex = str_replace(['S','G','I'], ['[S5]', '[G6]', '[I1]'], $input); echo $regex; echo (0 < preg_match("/$regex/", $store) ? 'Match' : 'No match');

preferences:
57.42 ms | 402 KiB | 5 Q