Functions

bytes()

bytes($string) 
package Haldayne

Parameters

$string

`int ini_size_to_bytes(string)` - Convert a short-hand bytes specification into integer bytes.

ini_size_to_bytes(string $string) : integer

Some PHP ini values (like upload_max_filesize) allow you to specify the number of bytes in a short-hand, like "10M" or "1G". But, when you call ini_get you'll get these actual short-hand values, instead of the byte equivalent (which usually you want).

This function converts a super-set of documented short-hand into bytes:

  • An optional leading +
  • Number specification in hex, octal, or decimal
  • Kilo-, Mega-, Giga-, and Tera-bytes expressed using single or double characters in either lower or upper case: "k", "kB", "G", "Pb", etc.
package Haldayne
see Documents the short-hand

Parameters

$string

string

A value from an ini_get call to process

Returns

integerNumber of bytes the short-hand string represents

Classes, interfaces, and traits

HtmlNameAccessorTrait

Accessor methods for the HTML name of a file upload.

« More »

Arrayable

« More »

Jsonable

« More »

GuardedMapAbstract

Restricts what can be set into a Map, optionally normalizing those values that can be set.

« More »

Map

API improvements for PHP associative arrays. Features a consistent fluent interface, keys of any type, a short-hand syntax for filtering expressions.

« More »

MapOfCollections

Implements a map that may only contain collection-like values.

« More »

MapOfFloats

Implements a map of floats, that is a Map whose values must all pass the `is_float` test.

« More »

MapOfInts

Implements a map of integers, that is a Map whose values must all pass the `is_int` test.

« More »

MapOfNumerics

Implements a map of numbers, that is a Map whose values must all pass the `is_numeric` test.

« More »

MapOfObjects

Implements a map that may only contain objects only.

« More »

MapOfStrings

Implements a map of strings, that is a Map whose values must all pass the `is_string` test.

« More »

SecurityConcernException

A specific kind of UploadException: the upload is suspicious.

« More »

ServerProblemException

A specific kind of UploadException: the server had a problem.

« More »

UploadConfig

Return information about the upload configuration.

« More »

UploadError

Represents a file that did not successfully upload.

« More »

UploadException

Represents an exception during upload.

« More »

UploadFile

Represents a file that has been successfully uploaded.

« More »

UploadIterator

Implements an iterator over the $_FILES super-global or an array of similar structure.

« More »

CaptureErrors

Runs a callable, capturing all error messages, then provides a method to extract any errors raised during execution.

« More »

ExceptionToError

Runs a callable, catching any exception and reflecting it into a triggered error.

« More »

Expression

Manufactures a callable from a string.

« More »

Improve

Start with a guess, then repeatedly update the guess until we're close enough to the desired solution.

« More »

Retry

Runs a callable, retrying using exponential back-off if the callable fails.

« More »

Y

Implements the Y-combinator.

« More »