Reputation: 2166
Can anyone please explain me how string handling is done in PHP. Is it the same as that of done with Java or any other way round. Is there anything like java's StringBuffer class in PHP which will improve the performance of my code while handlling strings.
Please shed light on this.
Upvotes: 3
Views: 2855
Reputation: 66851
Strings are mutable in php. The only reason something like a StringBuilder
is necessary in Java is because String
s are immutable. You can use the concatenation operator (.
) all you want.
Upvotes: 3
Reputation: 2468
Strings are handled in PHP without much fuss or need for additional libraries (unless you want to start using stuff like UTF-8 encoding).
Native PHP strings are mutable just like the StringBuffer class.
The manual is a good place to start.
Upvotes: 2
Reputation: 16025
What sorts of issues are you expecting exactly? PHP is much more light-weight than Java and you shouldn't expect any performance problems.
For your reference, you can read up on strings in PHP: http://www.php.net/manual/en/book.strings.php
Upvotes: -1