Hàm strtolower() trong PHP - PHP Function
Code $string = "This is An EXAMPLE String"; $result = strtolower($string); echo $result;
Hàm strtoupper() trong PHP - PHP Function
<?php echo strtoupper('Welcome To Zaidap.com.net'); // WELCOME TO FREETUTS.NET ?>
Hàm strtr() trong PHP - PHP Function
Hàm strtr() sử dụng 3 tham số: Code $string = "This is an example String"; $result = strtr($string, "i", "a"); echo $result; Kết quả Thas as an example Strang
Hàm substr_compare() trong PHP - PHP Function
Code echo substr_compare("abcde", "bc", 1, 2) . '<br>'; // 0 echo substr_compare("abcde", "de", -2, 2) . '<br>'; // 0 echo substr_compare("abcde", "bcg", 1, 2) . '<br>'; // 0 echo substr_compare("abcde", "BC", 1, 2, true) . '<br>'; // 0 echo ...
Hàm substr_count() trong PHP - PHP Function
Sử dụng hàm substr_count() với 2 tham số: Code $string = "This is an example string"; $result = substr_count($string, "is"); echo $result; Kết quả 2
Hàm substr_replace() trong PHP - PHP Function
Sử dụng hàm substr_replace() thay thế toàn bộ chuỗi: Code $var = 'This is something'; echo $var . "<br />"; echo substr_replace($var, 'this is replace', 0) . "<br />"; echo substr_replace($var, 'this is replace', 0, strlen($var)) . "<br ...
Hàm substr() trong PHP - PHP Function
Code echo $rest = substr("abcdef", 0, 3) . "<br />"; echo $rest = substr("abcdef", 0, -1) . "<br />"; echo $rest = substr("abcdef", 2, -1) . "<br />"; if (substr("abcdef", 4, -4) == false) { echo 'false' . "<br />"; } echo $rest = ...
Hàm trim() trong PHP - PHP Function
Code $text = " ------This is a test -- string :) ... "; $hello = "Hello World"; var_dump($text); echo "<br />"; var_dump($hello); echo "<br />"; $trimmed = trim($text); var_dump($trimmed); echo "<br />"; $trimmed = trim($text, " ...
Hàm ucfirst() trong PHP - PHP Function
Code echo ucfirst("Zaidap.com.net") . "<br />"; echo ucfirst("this is a test") . "<br />"; echo ucfirst("FREETUTS.NET") . "<br />";
Hàm ucwords() trong PHP - PHP Function
Code echo ucwords("Zaidap.com.net", ".") . "<br />"; echo ucwords("this is a te.st", " .") . "<br />"; echo ucwords("FREETUTS.NET") . "<br />";
Hàm wordwrap() trong PHP - PHP Function
Cách sử dụng hàm wordwrap: Code $text = "this is a test stringgggggggggggggggggggggggg"; echo $newtext = wordwrap($text, 20, "-")."<br />"; echo $newtext = wordwrap($text, 8, "-", true)."<br />"; echo $newtext = wordwrap($text, 8, "-", ...
Hàm md5() trong PHP - PHP Function
$str = 'Zaidap.com.net'; echo md5($str); // 83617175fd8cf470d4af657a28def98e // hoặc echo md5($str, false); // 83617175fd8cf470d4af657a28def98e
Hàm sha1() trong PHP - PHP Function
$str = 'Zaidap.com.net'; echo sha1($str); // kêt quả: 8d9fa09de2e997d8fbb544326b84d1f894cd3ca3 echo sha1($str, false); // kêt quả: 8d9fa09de2e997d8fbb544326b84d1f894cd3ca3
Hàm md5_file() trong PHP - PHP Function
<?php $file = 'Zaidap.com.txt'; echo md5_file($file, false); // d41d8cd98f00b204e9800998ecf8427e ?>
Hàm hash_algos() trong PHP - PHP Function
Code $arr = hash_algos(); echo "<pre>"; print_r($arr); echo "</pre>";
Hàm hash() trong PHP - PHP Function
Mã hóa theo kiểu "ripemd160": Code echo hash('ripemd160', 'The quick brown fox jumped over the lazy dog.') . "<br />"; echo hash('ripemd160', 'The quick brown fox jumped over the lazy dog.', true); Kết quả ...
Hàm hash_init() trong PHP - PHP Function
Code $ctx = hash_init('md5'); hash_update($ctx, 'This a test string'); echo hash_final($ctx);
Hàm hash_update() trong PHP - PHP Function
Code $ctx = hash_init("md5"); echo hash_update($ctx, "this is a test") . "<br />"; echo hash_final($ctx) . "<br />"; echo md5("this is a test");
Hàm hash_final() trong PHP - PHP Function
Code $ctx = hash_init("md5"); hash_update($ctx, "this is a test") . "<br />"; echo hash_final($ctx) . "<br />";
Hàm hash_copy() trong PHP - PHP Function
Code $ctx = hash_init('md5'); hash_update($ctx, 'This is a test'); $copy = hash_copy($ctx); echo hash_final($ctx). "<br />"; echo hash_final($copy). "<br />";







