3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $elements = array( "eng%C3%A5%C2%BF%C2", "Products" ); $elements = array_slice( $elements, 0, 1 ); $name = implode( '_', $elements ); $name = preg_replace( array( '/[^a-zA-Z0-9]+/', '/_+/', '/^_/', '/_$/' ), array( '_', '_', '', '' ), $name ); echo $name;
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
eng_C3_A5_C2_BF_C2