- explode: documentation ( source)
<?php
function STR2VAR($strs){
$a = explode(',',$strs);
foreach($a as $key) {
global $$key;
$$key = 'test';
}
}
STR2VAR('exam1,exam2,exam3');
echo $exam1;