3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'text^name1^PETER~text^secondname1^SMITH~text^phone1^023482348~text^adres1^STREETAVENUE 1B~text^postcode1^91201CA~text^woonplaats1^LIVINGPLACE~email^email1^peter@example.com'; preg_match_all('/(?:text|email)\^([^^]+)\^([^^~]*)/', $string, $matches, PREG_SET_ORDER); var_export( array_column($matches, 2, 1) );

preferences:
23.93 ms | 406 KiB | 5 Q