PHP string kaldır alanı

2 Cevap

Is there php function to remove the space inside the string? for example: $abcd="this is a test" I want to get the string: $abcd="thisisatest"

Bunu nasıl? teşekkürler.

2 Cevap

Aşağıdakiler de çalışacaktır

$abcd="this is a test";
$abcd = preg_replace('/( *)/', '', $abcd);
echo $abcd."\n"; //Will output 'thisisatest';

veya

$abcd = preg_replace('/\s/', '', $abcd);

Manuel http://php.net/manual/en/function.preg-replace.php bakın

$abcd = str_replace(' ', '', 'this is a test');

Bkz http://php.net/manual/en/function.str-replace.php