开发者

Can i separate a php variable?

开发者 https://www.devze.com 2023-01-15 00:48 出处:网络
okay so lets say$word = abcdefg@hijk.lmn can i make a new v开发者_JAVA百科ariable only everything upto the \"@\"

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

精彩评论

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