granam/tools

Toolbox

Installs: 40 012

Dependents: 12

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 0

Open Issues: 0

Type:project

6.1.0 2021-03-24 16:40 UTC

README

use namespace Granam\Tools\ValueDescriber;

// "instance of \stdClass'
echo ValueDescriber::describe(new \stdClass());

// "array {}"
echo ValueDescriber::describe([]);

// "resource"
echo ValueDescriber::describe(tmpfile());

// "123,123.45,'123','123.45',array {\n  0 => string(3) "bar"},instance of \stdClass"
echo ValueDescriber::describe(123, 123.45, '123', '123.45', ['bar'], new \stdClass());

File upload exception

if ($_FILES['user_attachment1']['error'] === UPLOAD_ERR_OK) {
    // upload successful
} else {
// File of name 'damn_big.png' has not been uploaded (The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form: 2000)
    throw new FileUploadException("File of name '{$_FILES['user_attachment1']['name']}' has not been uploaded", $_FILES['user_attachment1']['error']);
}

Installation

composer require granam/tools