How to make slug removing whitespaces in php

$data = “new & item @ send to & be”; $data_slug = trim($data); //$search = array(‘/’,’\\’,’:’,’;’,’!’,’@’,’#’,’$’,’%’,’^’,’*’,'(‘,’)’,’_’,’+’,’=’,’|’,'{‘,’}’,'[‘,’]’,'”‘,”‘”,'<‘,’>’,’,’,’?’,’~’,’`’,’&’,’ ‘,’.’); $search = array(‘/’,’\\’,’:’,’;’,’!’,’@’,’#’,’$’,’%’,’^’,’*’,'(‘,’)’,’_’,’+’,’=’,’|’,'{‘,’}’,'[‘,’]’,'”‘,”‘”,'<‘,’>’,’,’,’?’,’~’,’`’,’&’,’.’); $data_slug = str_replace($search, ” “, …

Read More