Ashley Sheridan;10945214 wrote:The zero tells PHP that it's a string
Well, it's technically a string simply because that is the variable type that [man]substr/man returns.
As you pointed out, however, "variable types" mean very little in PHP (as compared to a more strictly-typed language, e.g. C/C++) since it will pretty much convert between types as necessary.
The only reason I suggested using [man]printf/man (or, similarly, [man]sprintf/man) is that the zero's seemed to be strictly for display/formatting purposes, thus it would be appropriate to use a function that modifies how the data is displayed/formatted rather than trying to finagle the data itself back into what it "looked" like before.