3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str = 'dahazd %class% aiojdzn %attr% oij da %attr% eoijfze %attr% oizejj %class% iojzjf %class% oi oj%class%'; preg_match_all('/\%\w+\%/', $str, $data); var_dump($data); // preg_replace('', '', $str);
based on ANahq
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.3.0beta1
array(1) { [0]=> array(7) { [0]=> string(7) "%class%" [1]=> string(6) "%attr%" [2]=> string(6) "%attr%" [3]=> string(6) "%attr%" [4]=> string(7) "%class%" [5]=> string(7) "%class%" [6]=> string(7) "%class%" } }