Basically, I want to enter text into a text area, and then use them. For example
variable1:variable2@variable3
variable1:variable2@variable3
variable1:variable2@
Besides preg_split:
$line = 'variable11:variable12@variable13';
print_r(preg_split('/[:@]/', $line));
/*
Array
(
[0] => variable11
[1] => variable12
[2] => variable13
)
*/
you could do a preg_match_all:
$text = 'variable11:variable12@variable13
variable21:variable22@variable23
variable31:variable32@variable33';
preg_match_all('/([^\r\n:]+):([^\r\n@]+)@(.*)\s*/', $text, $matches, PREG_SET_ORDER);
print_r($matches);
/*
Array
(
[0] => Array
(
[0] => variable11:variable12@variable13
[1] => variable11
[2] => variable12
[3] => variable13
)
[1] => Array
(
[0] => variable21:variable22@variable23
[1] => variable21
[2] => variable22
[3] => variable23
)
[2] => Array
(
[0] => variable31:variable32@variable33
[1] => variable31
[2] => variable32
[3] => variable33
)
)
*/
if necessary, you could make several calls to "explode"
http://jp.php.net/manual/en/function.explode.php
try preg_split http://php.net/manual/en/function.preg-split.php