Top "Strpos" questions

PHP method to find the position of the first occurrence of a substring in a string

Using an array as needles in strpos

How do you use the strpos for an array of needles when searching a string? For example: $find_letters = array(…

php arrays strpos
PHP check if file contains a string

I'm trying to see if a file contains a string that is sent to the page. I'm not sure what …

php fopen strpos
Warning: array_push() expects parameter 1 to be array

This is my code, and when I run this function I get this :Warning: array_push() expects parameter 1 to be …

php arrays strpos
How to make strpos case insensitive

How can I change the strpos to make it non case sensitive. The reason is if the product->name …

php strpos
How to use strpos to determine if a string exists in input string?

$filename = 'my_upgrade(1).zip'; $match = 'my_upgrade'; if(!strpos($filename, $match)) { die(); } else { //proceed } In the code above, I'm trying …

php strpos
PHP substr after a certain char, a substr + strpos elegant solution?

let's say I want to return all chars after some needle char 'x' from: $source_str = "Tuex helo babe". Normally …

php substr strpos
Which method is preferred strstr or strpos?

I noticed a lot of developers are using both strstr and strpos to check for a substring existence. Is one …

php strpos strstr
php 5 strpos() difference between returning 0 and false?

if(strpos("http://www.example.com","http://www.")==0){ // do work} I'd expect this to resolve as true, which it does. …

php strpos
Simple PHP strpos function not working, why?

Why isn't this standalone code working: $link = 'https://google.com'; $unacceptables = array('https:','.doc','.pdf', '.jpg', …

php strpos
selecting an array key based on partial string

I have an array and in that array I have an array key that looks like, show_me_160 this array …

php arrays string substring strpos