开发者

Can i separate a php variable?

okay so lets say $word = abcdefg@hijk.lmn

can i make a new v开发者_JAVA百科ariable only everything upto the "@"

and another everything after?

( I.E. $one = abcdefg & $two = hijk.lmn )

thanks alot


use explode.

$word = 'abcdefg@hijk.lmn';
$my_array = explode('@', $word);
echo $my_array[0]; // prints "abcdefg"
echo $my_array[1]; // prints "hijk.lmn"

http://php.net/manual/en/function.explode.php


list($one, $two) = split("@", $word);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜