PHP remove all symbols from string

How to remove all symbol to string only in PHP, use preg_replace:

preg_replace('/[^\p{L}\p{N}\s]/u','', $x)

Sample remove all symbol end characters:

<?php
$x=’SSS abc saple sym@ “” 1 <> CK2‘;
echo $str = preg_replace(‘/[^\p{L}\p{N}\s]/u’,”, $x);?>

Result:

SSS abc saple sym 1 CK2

READ :  Cara Konfigurasi Seting Dasar CodeIgniter 3