php

  1. M

    [en] Fix bug PHP acos(1) returns NAN sometimes

    <?php $lat1 = 35.697959; $lat2 = 35.697959; $lon1 = 139.707085; $lon2 = 139.707085; $theta = $lon1 - $lon2; $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta)); var_dump($dist); // returns 1 $dist = acos($dist); var_dump($dist)...
  2. M

    [en] Fix bug Error "dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib" with php7.1

    I have [email protected], [email protected] in my Mac. After update brew, my [email protected] got this error ➜ ~ php -v dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib Referenced from: /usr/local/opt/[email protected]/bin/php Reason: image not found [1] 38924 abort php -v Then check icu4c info ~...
  3. M

    [en] Knowledge Install brew deprecated PHP version ([email protected], 5.6, 7.0) on Brew MacOS

    PHP 5.6, PHP 7.0, and PHP 7.1 are out of support by the php group (Ref: PHP: Supported Versions), So brew also deprecated & remove it. Now, only PHP 7.2 through 7.4 are officially supported by Brew and can be installed with brew install [email protected] so if you want to install PHP 5.6, PHP 7.0, or PHP...
  4. tidi1321

    [en] Knowledge Difference between include() and require()? Which one is better for security?

    require(): will throw a PHP Fatal Error if the file cannot be loaded (Execution stops) include(): produces a Warning if the file cannot be loaded (Execution continues) => require() is recommended to use for library files, files containing the functions and configuration variables. Using...
  5. M

    [vi] Kiến thức Dấu <=> trong PHP là gì? Toán tử spaceship trong php

    Bắt đầu từ PHP 7.x có giới thiệu 1 toán tử mới là spaceship operator ( <=> ). Toán tử dùng để so sánh 2 expression, và trả về kết quả -1, 0, 1 khi so sánh 1 biến $a có bé hơn, bằng, lớn hơn với biến $b. Nguyên lý PHP so sánh các biến vẫn follow theo type comparison rules. <?php // Integers...
  6. M

    [vi] Kiến thức Phân biệt isset() vs is_null() vs empty() trong PHP

    *undefined là không tồn tại hoặc chưa khai báo false khi true khi Báo lỗi khi $var is undefined isset($var) $var is undefined or = null $var is defined and != null Không empty($var) not empty (ngược lại) $var is defined nhưng không gán giá trị or = false or = "" (kiểu chuỗi) or = 0 or =...
  7. M

    [en] Knowledge Different betwen isset() vs is_null() vs empty() in PHP

    *undefined is doesn't exist or isn’t declared *note: '', array(), false is not null false when true when throw an error when $var is undefined isset($var) $var is undefined or = null $var is defined and != null NO empty($var) not empty (otherwise) $var is defined without value or =...

Facebook Comments

Top