I have a variable
<?php
$srch_key = 'asdfggfdsa' ;
?>
Now I want to make a separation with comma after 5 letters. For this I have done this code.
<?php
function ref_format($str, $step, $reverse = false) {
if ($reverse)
return strrev(chunk_split(strrev($str), $step, ','));
return chunk_split($str, $step, ',');
}
$passport = ref_format("$srch_key", 5);
echo $passport_key = substr($passport, 0, -1);
?>
The Output seems like this
asdfg,gfdsa
But I want to make the output like this
'asdfg','gfdsa'
How can I make this.