Personnellement, j’ai pas de meilleure façon! et vous ?
$attributes = array( 'href' => 'http://www.gezere.com/', 'title' => 'Gezere Solutions Web', 'class' => 'the-super-strategy-development-and-marketing-company' ); echo '<a ' . str_replace( array( '{"', '"}', '":"', '","', '\/' ), array( '', '"', '="', '" ', '/' ), json_encode( $attributes ) ) . '>The best compagny !</a>'; |
Merci pour vos trucs !
Ping : Transformer un tableau associatif en attributs HTML en une ligne ... | Le CM associatif | Scoop.it