Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php array trim keys

 public function fixArrayKey(&$arr): array
    {
        $arr = array_combine(
            array_map(
                static function ($str) {
                    return str_replace(" ", "", $str);
                },
                array_keys($arr)
            ),
            array_values($arr)
        );

        return $arr;
    }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #array #trim #keys
ADD COMMENT
Topic
Name
2+7 =