Q:

Splitting a string in PHP

I have a string that consists of data with various operators to separate it. I need to split the data according to some requirements.  I am working on a quiz application. I need to display the questions and their options. On page 1 I need to display a question and its options (based on the number of options that question has, make that many radio buttons dynamically). 

A:

While explode would normally suffice, with your multiple delimiters, try preg_split:
$chars = preg_split('/@|\|/', 'aaa@bbb|ccc', -1, PREG_SPLIT_NO_EMPTY);
print_r($chars);

Array ( [0] => aaa [1] => bbb [2] => ccc )

