Problem
Substituting and trimming string variables in PHP.
Solution
Similar to Perl, PHP has an extensive library of functions.
See the example tab for a few simple examples, showing the basic syntax.
Example
substr
$ php -q<<EOT
<?php
echo(substr("Hello World",0,4)."n");
?>
EOT
Hell
trim
$ php -q<<EOT
<?phpecho(trim(" Hello World ")."n");
?>
EOTHello World
Reference
[tags]PHP substr, PHP trim, PHP Coding School[/tags]