It's easier to just explode it and use the resulting array:
PHP Code:
<?php
$var = 'test@gmail.com~|~test@hotmail.com~|~test@grapevine.com';
$vars = explode('~|~', $var);
echo implode('<br>', $vars);
?>
But if you need individual variables, you could do a foreach on the array to make them:
PHP Code:
<?php
$var = 'test@gmail.com~|~test@hotmail.com~|~test@grapevine.com';
$vars = explode('~|~', $var);
foreach($vars as $key => $val){
$k = $key + 1;
$GLOBALS["var$k"] = $val;
}
echo $var1 . '<br>';
echo $var2 . '<br>';
echo $var3 . '<br>';
?>
Bookmarks