- array_map: documentation ( source)
- var_dump: documentation ( source)
- str_replace: documentation ( source)
- strtolower: documentation ( source)
<?php
function formatToId( $str ) {
return str_replace( " " , "-" , strtolower( $str ));
}
$metals = array( 'Or blanc' , 'Or jaune' , 'Or noir' , 'Or rose' , 'Platine');
echo var_dump($metals_key = array_map( "formatToId" , $metals ));
//array_fill_keys( $metals_key , $metals );