bootstrap80.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. use Symfony\Polyfill\Php84 as p;
  11. if (extension_loaded('mbstring')) {
  12. if (!function_exists('mb_ucfirst')) {
  13. function mb_ucfirst(string $string, ?string $encoding = null): string { return p\Php84::mb_ucfirst($string, $encoding); }
  14. }
  15. if (!function_exists('mb_lcfirst')) {
  16. function mb_lcfirst(string $string, ?string $encoding = null): string { return p\Php84::mb_lcfirst($string, $encoding); }
  17. }
  18. if (!function_exists('mb_trim')) {
  19. function mb_trim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Php84::mb_trim($string, $characters, $encoding); }
  20. }
  21. if (!function_exists('mb_ltrim')) {
  22. function mb_ltrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Php84::mb_ltrim($string, $characters, $encoding); }
  23. }
  24. if (!function_exists('mb_rtrim')) {
  25. function mb_rtrim(string $string, ?string $characters = null, ?string $encoding = null): string { return p\Php84::mb_rtrim($string, $characters, $encoding); }
  26. }
  27. }
  28. if (extension_loaded('bcmath')) {
  29. if (!function_exists('bcceil')) {
  30. function bcceil(string $num): string { return p\Php84::bcceil($num); }
  31. }
  32. if (!function_exists('bcdivmod')) {
  33. function bcdivmod(string $num1, string $num2, ?int $scale = null): ?array { return p\Php84::bcdivmod($num1, $num2, $scale); }
  34. }
  35. if (!function_exists('bcfloor')) {
  36. function bcfloor(string $num): string { return p\Php84::bcfloor($num); }
  37. }
  38. if (!function_exists('bcround')) {
  39. function bcround(string $num, int $precision = 0, $mode = RoundingMode::HalfAwayFromZero): string { return p\Php84::bcround($num, $precision, $mode); }
  40. }
  41. }
  42. if (\PHP_VERSION_ID >= 80200) {
  43. return require __DIR__.'/bootstrap82.php';
  44. }
  45. if (extension_loaded('intl') && !function_exists('grapheme_str_split')) {
  46. function grapheme_str_split(string $string, int $length = 1) { return p\Php84::grapheme_str_split($string, $length); }
  47. }