![](/themes/images/default.png)
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, "-", ...
![](/themes/images/default.png)
Hàm md5() trong PHP - PHP Function
$str = 'Zaidap.com.net'; echo md5($str); // 83617175fd8cf470d4af657a28def98e // hoặc echo md5($str, false); // 83617175fd8cf470d4af657a28def98e
![](/themes/images/default.png)
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
![](/themes/images/default.png)
Hàm md5_file() trong PHP - PHP Function
<?php $file = 'Zaidap.com.txt'; echo md5_file($file, false); // d41d8cd98f00b204e9800998ecf8427e ?>
![](/themes/images/default.png)
Hàm hash_algos() trong PHP - PHP Function
Code $arr = hash_algos(); echo "<pre>"; print_r($arr); echo "</pre>";
![](/themes/images/default.png)
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ả ...
![](/themes/images/default.png)
Hàm hash_init() trong PHP - PHP Function
Code $ctx = hash_init('md5'); hash_update($ctx, 'This a test string'); echo hash_final($ctx);
![](/themes/images/default.png)
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");
![](/themes/images/default.png)
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 />";
![](/themes/images/default.png)
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 />";
![](/themes/images/default.png)
Hàm hash_file() trong PHP - PHP Function
Code //tạo file mới file_put_contents("test.txt", "this is a test file content"); echo hash_file("md5", "test.txt");
![](/themes/images/default.png)
Hàm hash_equals() trong PHP - PHP Function
Code $expected = crypt('Zaidap.com.net', '$thisismysalt$'); $correct = crypt('Zaidap.com.net', '$thisismysalt$'); $incorrect = crypt('soccer', '$thisismysalt$'); var_dump(hash_equals($expected, $correct)); echo "<br />"; var_dump(hash_equals($expected, ...
![](/themes/images/default.png)
Hàm array() trong PHP - PHP Function
$bien = array(); echo '<pre>'; print_r($bien);
![](/themes/images/default.png)
Hàm array_chunk() trong PHP - PHP Function
$input_array = array('a', 'b', 'c', 'd', 'e'); echo '<pre>'; // Gom nhóm với mỗi nhóm là 2 phần tử print_r(array_chunk($input_array, 2));
![](/themes/images/default.png)
Hàm array_change_key_case() trong PHP - PHP Function
$mang = array( 'name' => 'thehalfheart', 'email' => 'thehalfheart@gmail.com', 'website' => 'Zaidap.com.net' ); echo '<pre>'; print_r(array_change_key_case($mang, CASE_UPPER)); // Hoặc array_change_key_case($mang, 1)
![](/themes/images/default.png)
Hàm in_array() trong PHP - PHP Function
$message = array("Hoc", "Lap", "Trinh", "Online", "Tai", "Zaidap.com.net"); if (in_array("Zaidap.com.net", $message)) { echo "Trong mảng có chứa Zaidap.com.net"; } // Hoặc if (in_array("Zaidap.com.net", $message, FALSE)) { echo "Trong mảng có chứa Zaidap.com.net"; }
![](/themes/images/default.png)
Hàm array_column() trong PHP - PHP Function
$records = array( array( 'id' => 2135, 'first_name' => 'John', 'last_name' => 'Doe', ), array( 'id' => 3245, 'first_name' => 'Sally', 'last_name' => 'Smith', ), array( 'id' ...
![](/themes/images/default.png)
Hàm array_combine() trong PHP - PHP Function
$keys = array( 'name', 'email', 'address', 'phone' ); $value = array( 'TheHalfHeart', 'TheHalfHeart@gmail.com', 'HCM CYTY', '0979 306 603' ); echo '<pre>'; print_r(array_combine($keys, $value));
![](/themes/images/default.png)
Hàm array_count_values() trong PHP - PHP Function
$result = array( 'value_cua_phan_tu' => 'so_lan_xuat_hien' );
![](/themes/images/default.png)
Hàm array_diff_assoc() trong PHP - PHP Function
Note: Các phần tử trả về chỉ ở mảng thứ nhất