Find a character in the string in PHP

xiaoxiao2021-03-06  69

Find characters in PHP have substr () and strstr's two functions, I don't have something you want to write a simple algorithm, you can find a character from a string to exist.

code show as below:

$ Str = "AAA"; $ SUBSTR = "A";

Function Check_Str ($ STR, $ SUBSTR) {? for ($ I = 0; $ i

? {

?? IF ($ substr == $ STR [$ I])

?? {

????? return true;

??}

?? Else

?? {

????? Return False;

???}

?}?

}

?>

The algorithm is simple, can't guarantee that there is no mistake, just entertainment ....

转载请注明原文地址:https://www.9cbs.com/read-120893.html

New Post(0)