-2

Im Using This Code In my Local Laravel and in success

public function dateForHuman($custom_timestamp) 
  {
        $date = bcsub($custom_timestamp, 25569, 10) * 86400;
        return date('Y-m-d H:i:s', $date);
  }

but When i try in my server, respond error Undefined Function bcsub()

  • 2
    https://www.php.net/manual/en/bc.installation.php, https://stackoverflow.com/a/44049872/1427878 – CBroe Aug 26 '20 at 08:19
  • Does this answer your question? [PHP, Call to undefined function bccomp](https://stackoverflow.com/questions/44049812/php-call-to-undefined-function-bccomp) – Jeremy McGibbon Aug 27 '20 at 02:53

1 Answers1

0

According to PHP documentation, BCMath is not available by default with PHP7 on Linux servers.

bcmath ist not installed automatically with php 7 on linux (ubuntu server) You have to use: sudo apt-get install php-bcmath

Please install it using apt-get: sudo apt-get install php-bcmath

Source: http://php.net/manual/en/bc.installation.php

VIKAS KATARIYA
  • 5,867
  • 3
  • 17
  • 34