Rahul Shelke
Rahul Shelke

Reputation: 2166

String handling in PHP

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

Answers (4)

ryeguy
ryeguy

Reputation: 66851

Strings are mutable in php. The only reason something like a StringBuilder is necessary in Java is because Strings are immutable. You can use the concatenation operator (.) all you want.

Upvotes: 3

trickwallett
trickwallett

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

CaptSaltyJack
CaptSaltyJack

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

Naftali
Naftali

Reputation: 146302

Well you can read all about strings in the php doc, that might answer some of your queries.

Upvotes: 0

Related Questions