Sir,
i am having a file i want to take a specify token from tyhat file how can i?
Example imy file it tt.txt and i am having
" adnbd asjha arun123 aksja;l"
i want to extract arun123 how can i
Arunkumar
| SitePoint Sponsor |




Sir,
i am having a file i want to take a specify token from tyhat file how can i?
Example imy file it tt.txt and i am having
" adnbd asjha arun123 aksja;l"
i want to extract arun123 how can i
Arunkumar
Where there is a will there is a way![]()
ArunKumar


regex, stristr, positional data with substr...take your pick
phpster
I wish my computer would do what I want it to.
Not what I tell it to do...




Sir,
i tried stristr
my code was
$handle = fopen("test.txt", "r+");
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
if($buffer == "arun123")
$domain = stristr($buffer, 'arun123');
echo "..........".$domain.";;;;;;;;;;;";
}
fclose($handle);
it is not working
Arunkumar
Where there is a will there is a way![]()
ArunKumar


try
cuz this line:PHP Code:$handle = fopen("test.txt", "r+");
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
if {stristr($buffer,"arun123")){
$domain = stristr($buffer, 'arun123');
echo "..........".$domain.";;;;;;;;;;;";
}
fclose($handle);
if($buffer == "arun123")
will never evaluate properly since yuou can't compare a chunk of a string to an entire string and hope to get a match...
phpster
I wish my computer would do what I want it to.
Not what I tell it to do...
Bookmarks