1<?php
2$stripped = str_replace(' ', '', "10 1000 0000 000");
3echo $stripped;
1$words = ' my words ';
2$words = trim($words);
3var_dump($words);
4// string(8) "my words"
5
1<?php
2
3$text = "\t\tThese are a few words :) ... ";
4$binary = "\x09Example string\x0A";
5$hello = "Hello World";
6var_dump($text, $binary, $hello);
7
8print "\n";
9
10$trimmed = trim($text);
11var_dump($trimmed);
12
13$trimmed = trim($text, " \t.");
14var_dump($trimmed);
15
16$trimmed = trim($hello, "Hdle");
17var_dump($trimmed);
18
19$trimmed = trim($hello, 'HdWr');
20var_dump($trimmed);
21
22// trim the ASCII control characters at the beginning and end of $binary
23// (from 0 to 31 inclusive)
24$clean = trim($binary, "\x00..\x1F");
25var_dump($clean);
26
27?>