<?php

if (!function_exists('e')) {
    /**
     * Escape HTML entities in a string.
     *
     * @param  string  $value
     * @return string
     */
    function e($value)
    {
        return htmlentities($value, ENT_QUOTES, 'UTF-8', false);
    }
}

if (!function_exists('array_except')) {
    /**
     * Get all of the given array except for a specified array of items.
     *
     * @param  array  $array
     * @param  array|string  $keys
     * @return array
     */
    function array_except($array, $keys)
    {
        foreach ((array) $keys as $key) {
            unset($array[$key]);
        }

        return $array;
    }
}

if (!function_exists('old')) {
    /**
     * Responsável por carregar campos de formulários após o request.
     *
     * @param string $fieldName
     * @return mixed
     */
    function old($fieldName) {
        if (isset($_POST[$fieldName])) {
            return $_POST[$fieldName];
        }
    }
}
