stripos is the case-insensitive counterpart of strpos, returning the position of a given string within another string.
Questions tagged [stripos]
67 questions
4
votes
3 answers
which is the fast process strpos()/stripos() or preg_match() in php
I just want to known which one will be fast of strpos()/stripos() or preg_match() functions in php.

Jayesh Dongare
- 61
- 1
- 9
4
votes
2 answers
why is a strpos that is !== false not true?
Consider the following example:
$a='This is a test';
If I now do:
if(strpos($a,'is a') !== false) {
echo 'True';
}
It get:
True
However, if I use
if(strpos($a,'is a') === true) {
echo 'True';
}
I get nothing. Why is !==false not ===true…

Pete
- 105
- 1
- 9
4
votes
1 answer
How to find specific characters using PHP
My task was to create a PHP file that will check a name coming from HTML GET and the basis are the following:
It can be from a-z in small or capital letters
25 or less characters length
Also add the TM Trademark as an exception
I don't know…

Adrian Roy Baguio
- 104
- 10
4
votes
3 answers
evaluate stripos(), what is the difference between !== FALSE and === TRUE?
I have this issue with a string:
$val = 'NOT NULL';
if(stripos($val, 'NULL') !== FALSE){
echo "IS $val";
}
It evaluates fine, but if I use === TRUE as evaluator, things go wrong.
The answer eludes me, please help me understand.

derei
- 193
- 2
- 4
- 17
3
votes
1 answer
string contains 5 numbers and line
I am looping trough a txt file which contains lines for example:
asdasdasd
lorem ipsum
lorem 12345-1
more lorem ipsum bacon
From this I need to know when the line founds text 12345-1
Lorem in the beging is inrelative.
Can I use stripos like
if…

Hene
- 159
- 3
- 13
2
votes
1 answer
preg_match VS. stripos in PHP
The target is to check a product description and to identify different characteristics/product options. The input data has the following structure:
// TABLE WITH INPUT DATA. STRUCTURE: PRODUCT_CATEGORY [0], PRODUCT_NUMBER[1], DESCRIPTION OF AN…

Clipart - Designer
- 47
- 8
2
votes
1 answer
arabic characters to ABCD characters
I am working with below code in php to show the arabic letters in roman ABCD characters as defined below in my code.
But it is not displaying properly. It is losing the character sorting also and not displaying some of the characters according to my…

usman610
- 479
- 1
- 5
- 22
2
votes
2 answers
stripos return false on number comparison
I have created a common function which check whether the given string exist in string or not. The function was working fine unless i reached to this problem. The problem is if i pass both find and string to 3 i.e int then it is returning false. I…

Curious
- 93
- 1
- 11
2
votes
1 answer
strpos/stripos (with strict comparison) failing
I currently have the following strpos/stripos (tried both, doesn't change outcome), used to flag certain needles from forum posts.
if (stripos($row->message, (string)$commit) !== false) {
// Do stuff
}
Stuff mostly works fine, however, in a few…

Ani
- 53
- 8
2
votes
1 answer
php stripos if page ==
I have the script as below:
2
votes
2 answers
strpos return wrong position at hebrew
I need help...
I have hebrew php string and I want search position of substring.
my code:
$string = "אבגד הוזח טי";
$find = "הוזח";
$pos = strpos($string, $find);
echo $pos;
The strpos found the substring, but return wrong value of position.
It…

igorb0214
- 67
- 2
- 2
- 9
1
vote
1 answer
How to pass multiple variables from global scope into callback scope?
I am trying to use below code to filter JSON data an it works flawlessly if I give filter
$search_text = '53';
$filter_name ='title';
$expected88 = array_filter($array, function($el) use ($search_text) {
return ( stripos($el['title'],…

sonutup
- 57
- 7
1
vote
1 answer
Strange result of stripos function
I run this code:
var_dump(stripos($virtualhost[1], "cold="));
echo '----------------------
'; var_dump($virtualhost[1]); And I get the following result: bool(false) ----------------------
string(206) "
'; var_dump($virtualhost[1]); And I get the following result: bool(false) ----------------------
string(206) "

Roman Balakirev
- 11
- 2
1
vote
1 answer
Find Characters Stripost From Database Using Loop If, Elseif and Else
I have the following code:
for ($y = 0; $y <= $count_1; $y++) {
for ($x = 0; $x <= $count_2; $x++) {
if((strpos($cat[$y],"Model 1")!==false)and (stripos($quest[$y],$search_quest[$x])!==false) and (stripos($answ[$y],$search_answ[$x])!==…

Agen007 DC
- 17
- 2
1
vote
1 answer
mb_stripos huge time difference
Hi I am working on full text search and in my function where i finding string position (for cut x chars before and after string occur) i am using php function mb_stripos(). There is while (code bellow) called few times per request. Strings are from…

Lajdák Marek
- 2,969
- 8
- 29
- 58