Mecha CMS

Deep learning on using the API.

Class From

Author: Taufik Nurrohman · 99 Views

Tweet

Convert back to X from Y.

Table of Content

Base64 

Decode Base64 string.

From::base64($input);

Example:

$test = From::base64('aSBsb3ZlIHlvdQ==');

Decimal 

Convert HTML decimal characters representation into their original characters.

From::dec($input);

Example:

$test = From::dec('I ❤ U');

Hexagonal 

Convert HTML hexagonal characters representation into their original characters.

From::hex($input);

Example:

$test = From::hex('I ❤ U');

HTML 

Encode HTML special characters.

From::html($input);

Example:

$test = From::html('<foo bar="baz">');

JSON 

Convert JSON into PHP object.

From::json($input);

Example:

$test = From::json('{"foo":"bar"}');

URL 

Encode URL special characters.

From::url($input, $raw = false);

Example:

$test_1 = From::url('foo bar+baz');
$test_2 = From::url('foo bar+baz', true);

YAML 

Convert YAML string into array.

From::yaml($input, $in = '  ', $ref = [], $e = true);

Example:

$test = From::yaml('foo: bar');