Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jan 2006
    Location
    Finland, Hollola
    Posts
    285
    Thanks
    8
    Thanked 0 Times in 0 Posts

    How to search a string for a specified string?

    Hey guys,

    How would I search a string for a text like:
    PHP Code:
    $string "My string goes here, do you see?";
    $search " h";

    if 
    php_super_cool_search_function($string,$search) > 0
     
    echo ("found!");
    else
     echo (
    "nothing found, sorry"); 
    What could be the php_super_cool_search_function?

    Thanks!
    PHP 5 & MySQL 5 (Y)

  • #2
    Regular Coder
    Join Date
    Jun 2005
    Posts
    804
    Thanks
    0
    Thanked 0 Times in 0 Posts
    strpos(). Be sure to read the specs before using.

  • #3
    Regular Coder
    Join Date
    Jan 2006
    Location
    Finland, Hollola
    Posts
    285
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Thanks a lot. Have you any good tip how to find functions in PHP manual? If I need something, I really have no idea how do I need to search the PHP manual...
    PHP 5 & MySQL 5 (Y)

  • #4
    Regular Coder
    Join Date
    Jun 2005
    Posts
    804
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There's a search box on php.net that lets you search their function list directly; it's in the upper-right corner.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •