Hàm hash_algos() trong PHP - PHP Function

Code $arr = hash_algos(); echo "<pre>"; print_r($arr); echo "</pre>";

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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ả ...

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

Hàm hash_init() trong PHP - PHP Function

Code $ctx = hash_init('md5'); hash_update($ctx, 'This a test string'); echo hash_final($ctx);

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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");

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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 />";

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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 />";

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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");

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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, ...

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

Hàm array() trong PHP - PHP Function

$bien = array(); echo '<pre>'; print_r($bien);

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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));

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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)

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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"; }

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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' ...

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

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));

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

Hàm array_count_values() trong PHP - PHP Function

$result = array( 'value_cua_phan_tu' => 'so_lan_xuat_hien' );

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

Hàm array_diff_assoc() trong PHP - PHP Function

Note: Các phần tử trả về chỉ ở mảng thứ nhất

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

Hàm array_push() trong PHP - PHP Function

$websites = array(); array_push($websites, 'code.Zaidap.com.net'); echo '<pre>'; print_r($websites);

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

Hàm array_diff_key() trong PHP - PHP Function

$mang1 = array('Zaidap.com', 'Zaidap.com.net', 'thehalfheart'); $mang2 = array('Zaidap.com.net', 'thehalfheart'); echo '<pre>'; print_r(array_diff_key($mang1, $mang2));

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

Hàm array_diff_uassoc() trong PHP - PHP Function

function key_compare_func($a, $b) { if ($a === $b) { return 0; } return ($a > $b)? 1:-1; } $array1 = array( "a" => "Zaidap.com", "b" => "www", "c" => "https://Zaidap.com.net" ); $array2 = array( "a" => "Zaidap.com", "b" ...

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021

Hàm explode() trong PHP - PHP Function

echo '<pre>'; print_r(explode(' ', 'hoc lap trinh online Zaidap.com.net'));

Tác giả: Tạ Quốc Bảo viết 14:46 ngày 06/04/2021