Refer Here%3B%20%2F%2F%20Removes%20special%20chars.%20%7D)
preg_replace('/[^A-Za-z0-9\-]/', '', $string);
Example
public function update(Request $request, $id)
{
log::info("mera data update aata hai");
log::info($request);
$typed=$request->name;
// Replaces all spaces with hyphens.
$res= preg_replace('/[^A-Za-z0-9\-]/', ' ', $typed); // Removes special chars.
log::info($res);
}
Top comments (0)