Had to test this, but:

`php -r "echo substr('foobar',0,10);"`

Gave me the expected result =)