src/Reform/Helper/Html.php
public static function attributes(array $attributes = array())
    {
        $text = array();
        foreach ($attributes as $key => $value) {
            //if we have numeric keys (e.g. checked), set the value as
            //the $key (e.g. checked="checked"), but only if it
            //doesn't exist already
            if (is_numeric($key)) {
                $value = htmlspecialchars($value);
                if (!isset($attributes[$value])) {
                    $text[] = $value . '="' . $value . '"';
                }
                continue;
            }
            $text[] = $key . '="' . htmlspecialchars($value) . '"';
        }

        return empty($text) ? '' : ' ' . implode(' ', $text);
    }
public static function attributes(array $attributes = array())
    {
        $text = array();
        foreach ($attributes as $key => $value) {
            //if we have numeric keys (e.g. checked), set the value as
            //the $key (e.g. checked="checked"), but only if it
            //doesn't exist already
            if (is_numeric($key)) {
                $value = htmlspecialchars($value);
                if (!isset($attributes[$value])) {
                    $text[] = $value . '="' . $value . '"';
                }
                continue;
            }
            $text[] = $key . '="' . htmlspecialchars($value) . '"';
        }

        return empty($text) ? '' : ' ' . implode(' ', $text);
    }
public static function attributes ( array $ attributes = array ( ) ) { $ text = array ( ) ; foreach ( $ attributes as $ key => $ value ) { //if we have numeric keys (e.g. checked), set the value as //the $key (e.g. checked="checked"), but only if it //doesn't exist already if ( is_numeric ( $ key ) ) { $ value = htmlspecialchars ( $ value ) ; if ( ! isset ( $ attributes [ $ value ] ) ) { $ text [ ] = $ value . '="' . $ value . '"' ; } continue ; } $ text [ ] = $ key . '="' . htmlspecialchars ( $ value ) . '"' ; } return empty ( $ text ) ? '' : ' ' . implode ( ' ' , $ text ) ; }
Create a string of attributes to use in an HTML tag.

@param  array  $attributes An array of keys and values
@return string The attributes with a leading space
Create a string of attributes to use in an HTML tag .