Skip to content

Instantly share code, notes, and snippets.

@JhonatanHern
Created May 2, 2019 15:07
Show Gist options
  • Save JhonatanHern/5dd76cb9955067fe40fa248f697960e1 to your computer and use it in GitHub Desktop.
Save JhonatanHern/5dd76cb9955067fe40fa248f697960e1 to your computer and use it in GitHub Desktop.
<pre>
<?php
$string = 'vrcec,wrcwercr,cref43e3d,c*&^U,efrwe';
echo $string;
echo "<br>";
$stuff = explode( ',' , $string );
print_r($stuff);
foreach ($stuff as $key => $value){
$cgars = str_split( $string );
foreach ($cgars as $key => $char) {
if (preg_match("/\w/", $char)) {
$cgars[$key] = $char;
} else {
$cgars[$key] = '';
}
}
$stuff[$key] = implode( '' , $cgars );
}
echo "<br>";
print_r($stuff);
?>
</pre>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment