php str_replace remove spaces code example Example: php string replace space $journalName = preg_replace('/\s+/', '_', $journalName);