Questions tagged [stripos]

stripos is the case-insensitive counterpart of strpos, returning the position of a given string within another string.

67 questions
0
votes
2 answers

PHP traverse a string and line break at certain substring

If I have this one long string: WAITLIST, 91630, ACCY 2001 , 10, Intro Financial Accounting, 3.00, Zou, Y, DUQUES 251, TR09:35AM - 10:50AM, 01/13/14 - 04/28/14 , , WAITLIST, 90003, ACCY 2001 , 11, Intro Financial Accounting, 3.00, Zou, Y,…
Philip McQuitty
  • 1,077
  • 9
  • 25
  • 36
0
votes
1 answer

Using stripos function in PHP but having conflict with variable

I am trying to solve an issue with a function stripos in PHP. We are doing promo codes and for instance, one promo code is "friends" and another is "friends40" and when someone types that in, it is saying that both of these are true so it will give…
0
votes
1 answer

Reading a log file into an array reversed, is it best method when looking for keyword near the bottom?

I am reading from log files which can be anything from a small log file up to 8-10mb of logs. The typical size would probably be 1mb. Now the key thing is that the keyword im looking for is normally near the end of the document, in probably 95% of…
user1547410
  • 863
  • 7
  • 27
  • 58
0
votes
1 answer

PHP Using Stripos and array_push

I'm new in stackoverflow. But I need help, look, i'm making a function that extract multiple words from a string. The problem is that it returns number. I tried it with another $cuerpo, but it doesn´t work, it returned me 4. Please help me. Thanks a…
Darkness
  • 101
  • 1
  • 13
0
votes
2 answers

Stripos start from end of string

I have some code that searches a huge log file and finds a keyword, for the majority of cases this is near the bottom of the document. It would be more efficient in this case to start my search at the bottom and work my way up. $pos =…
user1547410
  • 863
  • 7
  • 27
  • 58
0
votes
1 answer

How to pick part of text file in directory and print section with STRIPOS in PHP?

I am trying to read text from files in a directory and have it be displayed as description text below an image. I have been able to use the STRIPOS function to separate out each part of the text, except am having trouble with the last section. The…
Brad
  • 135
  • 1
  • 1
  • 8
0
votes
1 answer

How to make PHP code to check if title contains certain word? (Wordpress Shopp)

I'm using the WordPress Shopp plugin to sell products on my WordPress site. So far I love this plugin but I'm trying to do something custom and unfortunately I'm not good enough with PHP to figure this out on my own (I've done tons of research…
DigitalSky
  • 23
  • 11
-1
votes
1 answer

PHP: stripos doesn't find a value

I need to find one of the three words even if written at the beginning of the string and not just in the middle or at the end. This is my code:
Lilia
  • 139
  • 4
-1
votes
2 answers

I need to check if certain number is in string of numbers

I really need some help with this... i just cant make it work. For now i have this piece of code and it's working fine. What it does is... retuns all files within a directory according to date in their…
vixus
  • 57
  • 6
-1
votes
2 answers

How does stripos and str_replace work?

I am struggling to understand how the php functions stripos and str_replace work. I have a body of text such as : {% if group.newt !== "" %} XYZ's {% else %} ABC's {% endif %} and am wanting to replace that text with Go to this link www.google.com.…
grgre
  • 85
  • 7
-1
votes
2 answers

why does stripos evaluates to false

I have a string $x = 'hello world.'. I want to see if $x contains string $y = 'hello'. If i do stripos($x, $y); it returns a numeric 0, the index where string $y starts. However this evaluates to FALSE. How can I evaluate this so it returns…
user3738926
  • 1,178
  • 1
  • 10
  • 17
-1
votes
3 answers

unexpected 'OR' (T_LOGICAL_OR)

I've been trying to make an "active" state in Bootstrap, giving li a class="active" whenever it's on the specified site. I have this script:
Marcus
  • 67
  • 2
  • 12
-1
votes
2 answers

Php stripos for finding two words in one url

I want this script to read each line (all are urls) from a text file and parse it to check whether two given words exist in any of the urls of that particular website. I also want all the urls (lines) in the text file be printed serially numbered.…
user7190475
-1
votes
3 answers

Or operator not displaying content

Im trying to get something to be echoed if the user is on one of the two pages, but it isn't echoed if(stripos($_SERVER['REQUEST_URI'], 'user.php') || ($_SERVER['REQUEST_URI'], 'message.php')) { echo 'hello'; }
bob jomes
  • 271
  • 1
  • 4
  • 13
-1
votes
5 answers

Check if an array element is in a string

This question has been asked before about strings, however *none of the questions I've reviewed (not mods do not remove or tell us this is a duplicate please) actually answer my question. I have a landing page with a simple signup via email box.…
GeordieDave1980
  • 589
  • 4
  • 11
  • 25