Without Leading Spaces php code example
Example 1: remove empty spaces php
$string = str_replace(' ', '', $string);
Example 2: trim specific character from strin using php
$widget_id = trim($widget_text,'[]')
$string = str_replace(' ', '', $string);
$widget_id = trim($widget_text,'[]')