strstr(\$a, \$b) and strchr() equally , It's also known as , Expression lookup \$a For the first time \$b, And returns the rest of the string ：

.strrchr() From the back to the front, the first one that appears

Just write two lines of code ：

```<?php
\$str = 'abc0';
echo strstr(\$str, '0');//
echo '<hr/>';
echo strstr(\$str, '0') == '0';//
echo '<hr/>';
// Notice the difference between two equal signs and three equal signs , character string 0 and false It's the same after cast . So when applying To use ===
echo strstr(\$str, '0') == false;
echo '<hr/>';
echo strstr(\$str, '0') === false;// false
echo '<hr/>';
\$str = 'abcabcdefg';
// A very common one substr() and strchr() Combined use , Take what appears after this character
echo substr(strchr(\$str, 'd'), 1);// efg
echo '<hr/>';
// You can do that Of course you have to know 'd’ Is there any , You can judge !==false
echo substr(\$str, stripos(\$str, 'd')+1);// efg
echo '<hr/>';
// Check the first one from back to front f appear
echo strrchr(\$str, 'f');// fg```
` `

Practice the algorithm , use php Part of the implementation strstr() function , Check whether a string is a substring of another string , A simple test can

```<?php
/**
* @param \$a
* @param \$b
* b It's a substring
* a It's full
*/
function str(\$a, \$b){
\$alen = strlen(\$a);
\$blen = strlen(\$b);
for(\$i=0; \$i<= (\$alen - \$blen); \$i++){
if(\$a[\$i] == \$b[0]){
\$x = \$i;
for(\$j=0; \$j< \$blen; \$j++){
if(\$b[\$j] != \$a[\$i++]){
\$i = \$x;
break;
}
}
if(intval(\$j) == \$blen){
return true;
}
}
}
return false;
}```

1. php in strstr、strchr、strrchr、substr、stristr

One .strstr and strcchr The difference between strstr    Show the first time you find , String to find , And the following string . strrchr  Show last found , String to find , And the following string . Two .strstr ...

2. PHP String function strstr stristr strchr strrchr

strstr -- First occurrence of lookup string , Returns a string from the first occurrence to the end or beginning of the string . stristr -- strstr Ignore case version of function strchr -- strstr The difference of function ...

3. Trees on the level UVA - 122 Review the binary tree building process ,bfs,queue,strchr,sscanf Use .

Trees are fundamental in many branches of computer science (Pun definitely intended). Current state- ...

4. PHP Medium stristr(),strstr(),strpos() Speed comparison

Speed code : <?php function getmicrotime() { list(\$usec, \$sec) = explode(" ",microtime()); ret ...

5. c Language ,strchr(), Find the position of the first character in the string

int main(void) { char string[15]; char *ptr, c = 's'; strcpy(string, "This is a string"); ...

6. strcpy、strncpy、strlen、memcpy、memset、strcat、strncat、strcmp、strncmp,strchr

1.strcpy #include<stdio.h> #include<assert.h> char *mystrcpy(char *dest, const char *src ...

7. 【C Programming based 】C Program commonly used functions

Basic knowledge of 1.const const Decorated data type refers to constant type , The value of a constant type variable or object cannot be updated . ; or ; // In defining the const variable , It usually needs to be initialized , Because there's no chance to change it in the future ...

8. strstr() Lookup function ,strchr(),strrchr(),stristr()/strpos(),strrpos() Find the string position

Look for a matching string or character in a longer string , among strstr() and strchr() It's exactly the same . example : echo strstr('why always you','you'); Output : you If ...

9. php -- strpos,stripos,strrpos,strripos,strstr,strchr,stristr,strrchr

strpos() function grammar : mixed strpos ( string \$haystack , mixed \$needle [, int \$offset = 0 ] ) lookup needle  stay h ...

## Random recommendation

1. DEDECMS Of the six Website map 、RSS Map

I'm weaving dreams CMS All those who do websites know , In its robots.txt It's the shield data The directory , But , unfortunately dedecms The default site map is in data Under the , To make spiders crawl better , It is necessary to dedecms The generated site map is placed in ...

2. MVC Use in SignalR Create cool and practical instant messaging function with source code

Preface , Now I'm sorry to send out a post without a preface . The main content of this post comes from a small function I developed in my previous project , be used for OA Instant messaging in . Because I was in a hurry , Forget to take out the code . Think about it more than half a year ago , Time goes by ...

3. getMeasuredHeight() And getHeight() The difference between

http://www.cnblogs.com/x-dev/p/3767538.html?utm_source=tuicool&utm_medium=referral public final ...

4. All say ConcurrentDictionary&lt;TKey, TValue&gt; There are traps

Look at these explanations ( English original ): private static void ConcurrentDictionary() { var dict = new ConcurrentDictionary<i ...

5. The improved SMO Algorithm

S. S. Keerthi Et al. Improvements to Platt's SMO Algorithm for SVM Classifier Design In this paper, the author puts forward the idea of SMO Algorithm improvement , throughout SMO ...

6. iOS Development ～ Application design philosophy ： View controller （UIViewController）、 View （UIView）

Application design philosophy : View controller (UIViewController). View (UIView) Using the view controller ( Bottom ) Manage views ( appearance ), one-on-one 1. The function of view : Responsible for the appearance of the display 2. The role of view controller : Create interface . ...

7. Qt-- take Qt Dynamic link generated exe And dependence dll Packaging method

Qt Static compilation link generated exe file , No need to rely on dll, Can run independently , It's easy to publish . But most of them are Qt Open source version , If you use static links , There will be some restrictions . One method , It's just dynamic compilation , And then put exe And what you need dll Integrate into one ...

8. Dig the plug-in v1.5 Version release

Chrome Image download Plug-in , Support web screen capture v.1.5 Update instructions : 1. Add the option to save the downloaded pictures by date , Easy to manage , The user can turn on / Turn off this setting 2. Add the shortcut key of web image collection : (1) Capture page images (Ctrl+ ...

9. ViewPager + Infinite rotation + Sliding speed modification + It's a little bit smaller

Develop habits , Have done code record summary . ViewPager Use records 1. ViewPage be located V4 package . 2. It's mainly used to do banner Wheel planting . 3. principle : Adapter reuse improves efficiency , And listview Wait for a principle . The following is a note ...

10. stay VMware In Chinese, it means Redhat HAT Configure local yum Source

stay VMware In Chinese, it means Redhat HAT Configure local yum Source Ready to use today CM Install big data environment , To the need for several machines to use the same set yum Only the source can , So I thought of Redhat Copy the image file to the virtual machine , Use when suspended , Finally through ht ...