Is the strstr () function of php highly efficient? What should I do?

Source: Internet
Author: User
Is the strstr () function of php highly efficient? I am a newbie. I want to use a project that matches strings. the efficiency requirement is high. is the strstr algorithm in php highly efficient? Is kmp algorithm used in it? Is the Sunday algorithm used ?, I only know that php built-in functions are okay. Do you want to use UDFs ?, Str * class functions are generally faster than regular expressions ., Is it highly efficient to search for strstr () functions that require php words?
I am a newbie. I want to use a project that matches strings. the efficiency requirement is high. is the strstr algorithm in php highly efficient? Is kmp algorithm used in it? Is the Sunday algorithm used?

------ Solution --------------------
I only know that php built-in functions are okay. Do you want to use UDFs?
------ Solution --------------------
Str * class functions are generally faster than regular expressions.
------ Solution --------------------
It is highly efficient to use strstr to search and obtain strings. You only need to find the existence or not and do not need to get the string. strpos is the most efficient.
------ Solution --------------------
String lookup functions must be more efficient than regular classes. This strstr () is very efficient. This function is binary secure.
------ Solution --------------------
It is not clear about the internal implementation algorithm of strstr, but you can view the source code of this function.
Unless you write in c, the user-defined function cannot be higher than the built-in function.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.