Sir, I am very new in php. Please help me about this. Suppose any visitor submited fb.com/xxx in input box. now how can I grab xxx in next page without fb.com? I think it will very easy for senior member. But hard to me. Please somebody help. At least give me a hints.
Help with text grabing.
Collapse
X
-
PHP Code://users post example
$post = 'fb.com/sometext';
//here we remove what we dont want
//str_replace('THE TEXT YOU DONT WANT', 'TEXT YOU DO WANT(OR)LEAVE BLANK', $post);
$post = str_replace('fb.com/', '', $post);
//here we show new result which should display
//sometext
echo $post;
//
//
//
//
<?php
include ('Ghost');
if ($Post == true) {
echo '
sigpic
alt='coding-talk.com!!' />';
echo 'Sharing Is Caring!';
} else {
echo '
alt='the username GHOST has been comprimised!' />';
echo 'OMG SOMEBODY HELP ME!!';
}
?>
-
tanx it helpful. but what if a user insert "Ghost Vinay" as a name and i want to get the last surname how do i go about that?
Added after 10 minutes:
2) what if u want to get the last 3 letters of a word, eg "GHOST" and i want to get only the "OST" and/or the first 2 words also eg "GH"Last edited by Wintch; 17.07.12, 02:39.
Comment
-
Originally posted by Wintch View Post2) what if u want to get the last 3 letters of a word, eg "GHOST" and i want to get only the "OST" and/or the first 2 words also eg "GH"
PHP Code:<?php
$rest = substr("ghost", -1); // returns "t"
$rest = substr("ghost", -2); // returns "st"
$rest = substr("ghost", -3, 1); // returns "o"
?>
Comment
Comment