About 1,670,000 results
Open links in new tab
  1. php strpos () difference between returning 0 and false?

    1 0 is a possible return value from strpos when it finds a match at the very beginning. In case if the match is not found it returns false (boolean). So you need to check the return value of …

  2. PHP Find all occurrences of a substring in a string

    Apr 1, 2013 · 76 I need to parse an HTML document and to find all occurrences of string asdf in it. I currently have the HTML loaded into a string variable. I would just like the character position …

  3. php - How to use strpos to determine if a string exists in input …

    strpos returns false if the string is not found, and 0 if it is found at the beginning. Use the identity operator to distinguish the two:

  4. php - Is strpos the fastest way to search for a string in a large body ...

    Oct 6, 2010 · According to the PHP manual, yes- strpos () is the quickest way to determine if one string contains another. Note: If you only want to determine if a particular needle occurs within …

  5. php - How to get the last occurrence of a string? - Stack Overflow

    Jun 25, 2018 · 2 What about using just PHP's built in function?! strripos () – Finds the position of the last occurrence of a string inside another string. It is a Case-insensitive. PHP Docs

  6. php - why is a strpos that is !== false not true? - Stack Overflow

    Sep 27, 2018 · The strpos function returns an integer value on success and false only if the needle was not found in the string. In our case, the string 'This is a test' contains 'is a'. So the …

  7. php - Question about strpos: how to get 2nd occurrence of a …

    I understand that this function will get the first occurrence of the string. But what I want is the 2nd occurrence. How to go about doing that?

  8. string - strpos function in reverse in php - Stack Overflow

    Welcome to Stack Overflow! Not to discourage you too much from asking, but always remember to Google first - when searching for strpos function in reverse in php, strrpos() turns up in third …

  9. php - Which method is preferred strstr or strpos ? - Stack Overflow

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

  10. PHP: How to Properly Use Strpos () to Find a Word in a String

    Jun 14, 2017 · 0 If one is experienced in PHP, then one knows how to find whole words in a string and their position using a regex and preg_match () or preg_match_all. But, if you're looking …