PhP regex, remove white spaces and all special characters from string : <p>I have a variable $name which can sometimes contain spaces and special characters like '%' '&amp;' etc.how can I remove all of those using regex or in any other way?</p>

<pre><code> */
public function handle()
{
    $urls = Business::pluck('ical');
    $names = Business::pluck('name');
    foreach ($urls as $url) {
        foreach ($names as $name) {
            $test= explode("\n", $name);
            dd($test);
        $response = Curl::to($url)
            -&gt;download('ical/'.$name.'.ics');
    }   
</code></pre>
