[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/vendor/splitbrain/lesserphp/src/Utils/ -> Util.php (summary)

(no description)

File Size: 128 lines (4 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Util:: (4 methods):
  clamp()
  pregQuote()
  toBool()
  convert()


Class: Util  - X-Ref

Miscelaneous utility methods

clamp(float $v, float $max = 1, float $min = 0)   X-Ref
Clamps a value between a minimum and maximum value.

This function takes a value and two boundary values (maximum and minimum).
It ensures that the provided value does not exceed the boundaries.
If the value is less than the minimum, the minimum is returned.
If the value is greater than the maximum, the maximum is returned.
Otherwise, the original value is returned.

pregQuote(string $what)   X-Ref
Quote a string for use in a regular expression


toBool($a)   X-Ref
Return a boolean type

param: mixed $a

convert($number, $to)   X-Ref
Converts numbers between different types of units