Advertisement
Virajsinh

implode single quote

Aug 13th, 2022
835
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.16 KB | None | 0 0
  1. $arr = ['qwerty', 'QTPQ', 'FRQO'];
  2.  
  3. $str = implode(', ', array_map(function($val){return sprintf("'%s'", $val);}, $arr));
  4.  
  5. echo $str; //'qwerty', 'QTPQ', 'FRQO'
  6.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement