1. Hàm strlen
1. <? $str = 'abcdef'; echo "strlen('abcdef')=",strlen($str);?><br />
2. Hàm str_replace
2. <? $str="abc_ABC_abc"; echo str_replace("abc","xyz",$str),"<br>";?>
3. <? $str="abc_ABC_abc"; echo str_ireplace("abc","xyz",$str),"<br>";?>
4. <? $s=array('A','B','C'); $t=array('B', 'C', 'D');echo str_replace($s,$t,"AE")?> <br />
3. Hàm strpos
5. strpos: <? $me="abcDabcd"; $con="d"; echo strpos($me, $con);?><br />
6. stripos:<? $me="abcDabcd"; $con="d"; echo stripos($me, $con);?><br />
4. Hàm number_format
7. number_format 1234.5678 :
<? $number = 1234.5678;
echo " en_format=". number_format($number, 2, '.', ',') ;
echo ", vi_format=", number_format($number, 2 , "," , "."), "<br/>" ;
?>
5. Hàm addslashes
8. addslashes : <?=addslashes("Chào 'sếp' "); ?><br />
6. Hàm stripslashes
9.stripslashes: <?=stripslashes("Chào \'sếp\' ");?><br />
7. Hàm htmlentities
10.htmlentities: <?=htmlentities("Chào 'sếp' <b>Mập</b> ",ENT_QUOTES, 'utf-8');?><br />
8. Hàm strip_tags
11.strip_tags:<?=strip_tags("<b><i>PHP</i></b> "),strip_tags("<b><i>PHP</i></b>","<b>"); ?><br />
No comments:
Post a Comment