Reputation: 2094
Sample input:
$word = '[email protected]';
Can I make variables to contain everything up to the "@" and everything after?
Desired result:
$one = 'abcdefg';
$two = 'hijk.lmn';
Upvotes: 1
Views: 156
Reputation: 76766
use explode
.
$word = '[email protected]';
$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
Upvotes: 4