3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = array('lastname', 'email', 'phone'); $comma_separated = implode("','", $array); $final_output = '[\'' . $comma_separated . '\']'; echo $comma_separated; // lastname,email,phone echo '<br />'; echo $final_output; echo '<br />'; $newArray = explode(",", $comma_separated); foreach ($newArray as $i){ echo $i; echo '<br />'; } ?>
based on 6gWH2
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.3.0rc2
lastname','email','phone<br />['lastname','email','phone']<br />lastname'<br />'email'<br />'phone<br />