stripos is the case-insensitive counterpart of strpos, returning the position of a given string within another string.
Questions tagged [stripos]
67 questions
-1
votes
2 answers
Request URI - If URL contains X & does Not contain Y - then do something
Hi there my current code looks like this:
if (stripos($_SERVER['REQUEST_URI'],'cake') !== false)
{echo ' >> View all Cakes';}
This works well to check if the…

Stew
- 3
- 3
-1
votes
1 answer
stripos() doesnt recognize first character
I am asking a question that I feel has no answer and I am curious as to why.
I have a test products array that lists all my people get_products_all().
function get_products_all() {
$products = array();
$products[101] = array(
"name" =>…

jlango7
- 3
- 2
-1
votes
1 answer
PhP fread and stripos
I´m getting data with
$newtext = fread($rcon, 102400);
But this script is not working. I tried it with different things burning thing the text I get from my rcon function is not a normal text... Does it make sense ?
$offset = stripos($newtext,…

Architect
- 1
- 3
-1
votes
3 answers
PHP - How do I check if a string contains a word?
Good evening.
I'm making an IRC bot that responds when you mention him. What I want to know is how to make him reply when someone actually says his name. This is what I have so far ($match[3] is the message that someone said on a channel and yes,…

LunarMage
- 11
- 1
-2
votes
2 answers
Get all occurrences of a string between two delimiters in PHP
I am using a PHP function to get all content between two delimiters in a string. However, if I have multiple occurrences of the string, it only picks up the first one. For example I'll have:
|foo| hello |foo| nothing here |foo| world |foo|
and the…

awholegnuworld
- 381
- 1
- 12
-2
votes
1 answer
strpos() show n character before and after specified word
I wrote a simple search engine and want to show some text in result, actually I want to show 200 character before SEARCH QUERY and 200 character after SEARCH QUERY.
Example:
SEARCH QUERY: TEST
RESULT:
BLAH BLAH BLAH BLAH BLAH BLAHBLAH BLAH…

Pedram
- 15,766
- 10
- 44
- 73
-3
votes
2 answers
PHP Stripos Check for two Words in a URL string
I'm currently using PHP Stripos OK to look for a word (parrots) is present within a URL.
However I now need to check that 2 words (green and parrots) are present in a URL, i.e. they must both be present.
Here's the current code:
if…

Stew
- 3
- 3