src/ArrayExtension.php
public function htmlAttributes($array)
    {
        if (!isset($array)) {
            return null;
        }
       
        $str = "";
        foreach ($array as $key => $value) {
            if (!isset($value) || $value === false) {
                continue;
            }
            
            if ($value === true) {
                $value = $key;
            }
            
            $str .= ' ' . $key . '="' . addcslashes($value, '"') . '"';
        }
        
        return trim($str);
    }
public function htmlAttributes($array)
    {
        if (!isset($array)) {
            return null;
        }
       
        $str = "";
        foreach ($array as $key => $value) {
            if (!isset($value) || $value === false) {
                continue;
            }
            
            if ($value === true) {
                $value = $key;
            }
            
            $str .= ' ' . $key . '="' . addcslashes($value, '"') . '"';
        }
        
        return trim($str);
    }
public function htmlAttributes ( $ array ) { if ( ! isset ( $ array ) ) { return null ; } $ str = "" ; foreach ( $ array as $ key => $ value ) { if ( ! isset ( $ value ) || $ value === false ) { continue ; } if ( $ value === true ) { $ value = $ key ; } $ str .= ' ' . $ key . '="' . addcslashes ( $ value , '"' ) . '"' ; } return trim ( $ str ) ; }
Cast an array to an HTML attribute string

@param mixed $array
@return string
Cast an array to an HTML attribute string