Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. NumericComparator.php

function NumericComparator::accepts

Overrides ScalarComparator::accepts

File

vendor/sebastian/comparator/src/NumericComparator.php, line 23

Class

NumericComparator

Namespace

SebastianBergmann\Comparator

Code

public function accepts(mixed $expected, mixed $actual) : bool {
    // all numerical values, but not if both of them are strings
    return is_numeric($expected) && is_numeric($actual) && !(is_string($expected) && is_string($actual));
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal