Go Back   Armenian Knowledge Base > Technical sections > Webmaster Zone > Web Development

Reply
 
Thread Tools

' and "
Old 29.03.2003, 15:09   #1
Moderator
 
acid's Avatar
 
Join Date: 09 2001
Location: South Korea, Gumi
Posts: 7,699
Blog Entries: 16
Rep Power: 7
Default ' and "

What is the difference between using " and ' for string operations in PHP/Perl.

Old 29.03.2003, 17:12   #2
Moderator
 
Join Date: 03 2002
Location: Russia
Posts: 123
Rep Power: 0
Default

В PHP различие такое:
Variable parsing
When a string is specified in double quotes or with heredoc, variables are parsed within it.
There are two types of syntax, a simple one and a complex one. The simple syntax is the most common and convenient, it provides a way to parse a variable, an array value, or an object property.
The complex syntax was introduced in PHP 4, and can be recognised by the curly braces surrounding the expression.

На деле это выглядит так:
$test = 'test';
$s1 = 'this is the $test'; // this is the $test
$s2 = "this is the $test"; // this is the test

Использование " или ' сказывается на скорости. По поводу этого можно почитать статью "Оптимизация программ на PHP".
__________________
Життя - це не тільки будні © Nemiroff

Old 30.03.2003, 06:40   #3
Moderator
 
acid's Avatar
 
Join Date: 09 2001
Location: South Korea, Gumi
Posts: 7,699
Blog Entries: 16
Rep Power: 7
Default

Спасибо за инфу, кстати очень полезный сайт.

Old 30.03.2003, 09:21   #4
freelancer
 
Yerkanian's Avatar
 
Join Date: 06 2002
Location: the same place
Posts: 592
Rep Power: 0
Default

outdated, acid...

Old 30.03.2003, 10:03   #5
hov
В бой аргхххххххх!
 
hov's Avatar
 
Join Date: 09 2002
Location: Vik, Medieval Norway
Age: 43
Posts: 1,513
Rep Power: 5
Default

Quote:
Originally posted by hayk
В PHP различие такое:
Variable parsing

. . .
На деле это выглядит так:
$test = 'test';
$s1 = 'this is the $test'; // this is the $test
$s2 = "this is the $test"; // this is the test
. . .

Baci dranic ' jamanak escaping chi arvum aisinqn
PHP Code:
echo 'es gnaci tun\nmarshrutkov'
talisa >>>
es gnaci tun\nmarshrutkov
isk
PHP Code:
echo "es gnaci tun\nmarshrutkov"
talisa >>>
es gnaci tun
marshrutkov

Old 31.03.2003, 09:54   #6
Moderator
 
Join Date: 03 2002
Location: Russia
Posts: 123
Rep Power: 0
Default

hov
Это все написано в мануале. Не цитировать же его тут целиком.
__________________
Життя - це не тільки будні © Nemiroff

Old 31.03.2003, 11:18   #7
hov
В бой аргхххххххх!
 
hov's Avatar
 
Join Date: 09 2002
Location: Vik, Medieval Norway
Age: 43
Posts: 1,513
Rep Power: 5
Default

Quote:
Originally posted by hayk
hov
Это все написано в мануале. Не цитировать же его тут целиком.

Eto vopros ne ko mne....
i po-moemu voobshe ne k mestu
Reply




Реклама:
реклама
Buy text link .

All times are GMT. The time now is 15:26.
Top

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.