<?php trim($_POST["data"]); ?>

PHP
{{ \Illuminate\Support\Str::limit($productVal, 20, $end='...') }}$text = "      hello world   ";
$text = trim($text);

=> "hello world"
Source

Also in PHP: