Welcome to Great Excess arrow Website arrow php - website arrow Strings in PHP
Saturday, 06 September 2008
 
 
English Language
Bahasa Indonesia
Computer
Website
Gallery
Health
Ebook
Tips
Movies
Add Site
Directory Listing

Visitor Data
Your IP
38.103.63.59
United States United States :
Browser
Unknown Browser Unknown Browser
Operating System
Unknown Operating System Unknown Operating System

Strings in PHP | Print |
 

Like most other languages, PHP defines a string as a sequence of characters. It's important to understand that the concept of "character" is not limited to symbols people normally use in their day-to-day life, like the letters of the alphabet, digits, and punctuation marks. The meaning associated with the term "character" simply indicates a single byte of data. Depending on how this byte is used, it could mean a letter, the pixel of an image, or even part of a song encoded in MP3 format.

Because a character is intended as a single byte of data, the native PHP string functions are capable of handling only up to 256 values for each character. Some languages, such as Chinese and Japanese, for example, have far more than 256 characters; therefore, they cannot be properly represented using normal strings. Luckily, PHP provides a set of multibyte string functions (MBString) that can deal with these languages using special variables.

Speed and Efficiency of String Expressions

The three string definition notations that we examined so far provide different levels of performance.

Although it's unlikely that your application will suffer performance degradation because of your string expressionsit's much more likely that you'll have to deal with other, bigger problems firstit's good to know that the fastest way to declare a string is to use single quotation marks, because the interpreter does not have to scan the string to perform substitutions (excluding \' and \\).

The double-quote syntax is slower because the entire string expression has to be scanned and substitutions have to be made for the variable expressions in it. Finally, the heredoc syntax is the slowest, because on top of the scanning operations to detect substitutions and special characters, the interpreter also has to worry about finding your delimiter.

This entry was posted on . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a comment.
Users' Comments (0)

Comment an article
  Name
  E-mail
   Title
Available characters: 600
This image contains a scrambled text, it is using a combination of colors, font size, background, angle in order to disallow computer to automate reading. You will have to reproduce it to post on my homepage
Enter what you see:

No comment posted

 
Top! Top!