Link to home
Start Free TrialLog in
Avatar of narmi2
narmi2

asked on

Split string after first character

Dear Experts,

How do I split a string after the first character?

If I have

$mystring = "this is my string"

I want to end up with

$string_one = "t"'
$string_two = "his is my string"'

Thanks
Avatar of isaackhazi
isaackhazi

$string="this is my string"
$string_1=substr($string,0,1);
echo $string;

Avatar of narmi2

ASKER

What about string_two?
$string_one = "this is my string"
$string_two =substr($string_one,0,1);

Avatar of narmi2

ASKER

string one should only have "t"
string two should have the full string minus "t" for example "his is my string".
make three strings

$string_one = "this is my string"
$string_two =substr($string_one,0,1);
$stiring_three=substr($string_one,1,16);
ASKER CERTIFIED SOLUTION
Avatar of isaackhazi
isaackhazi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i hope you get the idea...

cheers
Avatar of narmi2

ASKER

The original string was just an example, it can be of any length, so a cannot use the fixed length of 16 to get string three in your example.