Using the 144-PHP trim function

? < PHP
     // define a plurality of strings 
    $ str1 = 'whello12x' ;
     $ str2 = '3462hello' ;
     $ Str3 = 'xayABCaxy' ;
     $ str1 = TRIM ( $ str1 , 'A..Z');         // removed both sides of the lowercase string 
    $ str2 = LTRIM ( $ str2 , '0..9');         // removing the left of the number string 
    $ Str3 = TRIM ( $ Str3 , 'Axy');         // removal string a, x, y letters on both sides of 
    echo "\ $ str1 post treatment is: { $ str1 }" ;
     echo "<br />\ $ Str2 after treatment is: {str2 $ } " ;
     echo " <br /> \ $ str3 after treatment is: { $ str3 } " ;
 >?

 

Guess you like

Origin www.cnblogs.com/tianpan2019/p/11022679.html