|
-
Oct 27th, 2005, 05:16 PM
#1
Thread Starter
Addicted Member
[RESOLVED] Word within string?
HI
How do I know if the word 'position' is within this string? is there an internal function to do this?
dsgsgdñlkjslkgjlfñjgpositionfdsñlkfñkldsf
The biggest man you ever did see was once just a baby.
Bob Marley
-
Oct 27th, 2005, 07:10 PM
#2
Lively Member
Re: Word within string?
Yes, take a look at str_pos()
Good luck
-
Oct 29th, 2005, 01:28 AM
#3
Hyperactive Member
Re: Word within string?
stristr
<?php
$string = 'Hello World!';
if(stristr($string, 'earth') === FALSE) {
echo '"earth" not found in string';
}
// outputs: "earth" not found in string
?>
Born to help others
(If I've been helpful then please rate my post. Thanks)
call me EJ or be slapped! 
-
Jun 16th, 2008, 02:27 PM
#4
Thread Starter
Addicted Member
The biggest man you ever did see was once just a baby.
Bob Marley
-
Jun 16th, 2008, 08:07 PM
#5
Re: [RESOLVED] Word within string?
For simply checking the presence of a substring within a string, strpos should be preferred over strstr and its variants because the former merely returns a position and the latter return the actual substring. strpos is thus more efficient.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|