Comparisons\sameScalar()

predicate variadic returns bool pure
...mixed → bool
At a glance — Direct variadic call — no curry. Useful for asserting type-homogeneity before processing a batch of values.

Direct predicate — returns true when every argument has the same PHP type.

/**
  * @param mixed ...$variables
  * @return bool
  */
Comparisons\sameScalar(...$variables): bool

Examples

Partial Application

This can be used to create a simple closure which can be used as a regular function.

var_dump(Comparisons\sameScalar(1, 2, 3));          // true  (all ints)
var_dump(Comparisons\sameScalar('a', 'b', 'c'));    // true  (all strings)
var_dump(Comparisons\sameScalar(1, '2', 3));        // false (int + string + int)

Details

Comparisons Functions

Releated Type check Functions