Hàm strchr() trong PHP - PHP Function
Code $var = "something@Free@tuts.net"; $result = strchr($var, "@"); $result_2 = strchr($var, "@", true); echo $result . "<br />"; echo $result_2;
Hàm strstr() trong PHP - PHP Function
Code $var = "something@Free@tuts.net"; $result = strstr($var, "@"); $result_2 = strstr($var, "@", true); echo $result . "<br />"; echo $result_2;
Hàm strcmp() trong PHP - PHP Function
Code $var1 = "Zaidap.com.net"; $var2 = "Zaidap.com.net"; if (strcmp($var1, $var2) == 0) { echo "hai chuỗi giống nhau <br />"; }else{ echo "hai chuỗi không giống nhau <br />"; } Kết quả hai chuỗi không giống nhau
Hàm strip_tags() trong PHP - PHP Function
Code $str = 'This is a <b> Example</b> <a href="#fragment">String</a> <p>this a other string</p>'; echo $str; echo strip_tags($str) . "<br />"; Kết quả This is a Example String this a other ...
Hàm stripcslashes() trong PHP - PHP Function
Code $str = 'this is a "test"'; echo $str . "<br />"; echo stripcslashes($str);
Hàm stripos() trong PHP - PHP Function
Code $str = 'this is my string'; echo stripos($str, "is"). "<br />"; echo stripos($str, "Is");
Hàm stripslashes() trong PHP - PHP Function
Code $str = 'this is a "test"'; echo $str . "<br />"; echo stripslashes($str);
Hàm stristr() trong PHP - PHP Function
Code $var = "something@Free@tuts.net"; $result = stristr($var, "@f"); $result_2 = stristr($var, "@f", true); echo $result . "<br />"; echo $result_2;
Hàm strlen() trong PHP - PHP Function
Code $str = "Zaidap.com.net"; $str_2 = " Zaidap.com.net "; $result = strlen($str); $result_2 = strlen($str_2); echo $result . "<br />"; echo $result_2;
Hàm strnatcasecmp() trong PHP - PHP Function
Code $str1 = "FREETUTS.net"; $str2 = "Zaidap.com.net"; $result = strnatcasecmp($str1, $str2); echo $result . "<br />"; echo strcmp($str1, $str2);
Hàm strnatcmp() trong PHP - PHP Function
Code $str1 = "FREETUTS.net"; $str2 = "Zaidap.com.net"; $result = strnatcmp($str1, $str2); echo $result . "<br />"; echo strnatcasecmp($str1, $str2);
Hàm strncmp() trong PHP - PHP Function
Code $str1 = "Zaidap.com.net"; $str2 = "Zaidap.com"; $result = strncmp($str1, $str2, 4); echo $result . "<br />"; echo strcmp($str1, $str2); Kết quả 0 4
Hàm strpbrk() trong PHP - PHP Function
Code $str = "this is Zaidap.com.net"; $result = strpbrk($str, 'fh'); echo $result; Kết quả his is Zaidap.com.net Chuỗi trả về bắt đầu từ vị trí đầu tiên tìm thấy ( vị trí của kí tự h) và kéo dài đến hết chuỗi nguồn.
Hàm strpos() trong PHP - PHP Function
Code $str = 'abcdefghimk'; $pos = strpos($str, 'd'); echo $pos; Kết quả 3
Hàm strrchr() trong PHP - PHP Function
Code $str = 'this a test string'; $result = strrchr($str, 's'); if ($result == false) { echo "kí tự không tồn tại trong chuỗi"; }else{ echo $result; } Kết quả string
Hàm strrev() trong PHP - PHP Function
Code echo strrev('this is a test') . "<br />"; echo strrev('Zaidap.com.net') . "<br />"; echo strrev('hello world') . "<br />"; echo strrev('this is my example') . "<br />";
Hàm strripos() trong PHP - PHP Function
Code $str = 'this is my string'; echo strpos($str, "is"). "<br />"; echo strripos($str, "Is"); Kết quả 2 5
Hàm strrpos() trong PHP - PHP Function
Code $str = 'this is my string'; if (strrpos($str, "is") == false) { echo "chuỗi 'is' không tồn tại trong chuỗi nguồn!<br />"; }else{ echo strrpos($str, "is"). "<br />"; } if (strrpos($str, "Is") == false) { echo "chuỗi 'Is' không tồn tại trong chuỗi ...
Hàm strspn() trong PHP - PHP Function
Code $str = "abcd efgh iklm"; echo strspn($str, 'ab') . "<br />"; echo strspn($str, 'abcd') . "<br />"; echo strspn($str, 'abcd', 2) . "<br />"; echo strspn($str, 'abcd', 0, 2) . "<br />";
Hàm strtok() trong PHP - PHP Function
Code $string = "This is an example string"; echo strtok($string, "an") . "<br />"; echo strtok($string, "s") . "<br />"; echo strtok($string, "z") . "<br />"; Kết quả This is <br>Thi<br>This is an example string







