Retrieving text

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
User avatar
menator01
New php-forum User
New php-forum User
Posts: 6
Joined: Sat May 10, 2014 3:29 pm

Re: Retrieving text

Post by menator01 » Sun May 11, 2014 11:29 pm

You could use explode to do that. :)

User avatar
menator01
New php-forum User
New php-forum User
Posts: 6
Joined: Sat May 10, 2014 3:29 pm

Re: Retrieving text

Post by menator01 » Thu May 15, 2014 3:06 am

Code: Select all

<?php
$sms = 'username John';
$sms = explode(' ', $sms);
echo $sms[1];
?>
Explode will turn the string into an array

User avatar
menator01
New php-forum User
New php-forum User
Posts: 6
Joined: Sat May 10, 2014 3:29 pm

Re: Retrieving text

Post by menator01 » Fri May 16, 2014 9:50 am

use explode and then array_pop

us2rn4m2
New php-forum User
New php-forum User
Posts: 17
Joined: Thu Aug 09, 2012 1:28 pm

Re: Retrieving text

Post by us2rn4m2 » Fri May 23, 2014 1:37 pm

Code: Select all

echo strstr('username my_username', ' '); // my_username

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest