Armenian Knowledge Base  

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

Reply
 
LinkBack Thread Tools
Old 29.03.2003, 15:09   #1
Moderator
 
acid's Avatar
 
Join Date: 09 2001
Location: South Korea, Gumi
Posts: 7,699
Downloads: 102
Uploads: 34
Blog Entries: 16
Reputation: 561 | 6
Default ' and "

What is the difference between using " and ' for string operations in PHP/Perl.
Reply With Quote
Old 29.03.2003, 17:12   #2
Moderator
 
Join Date: 03 2002
Location: Russia
Posts: 123
Downloads: 0
Uploads: 0
Reputation: 0 | 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
Reply With Quote
Old 30.03.2003, 07:40   #3
Moderator
 
acid's Avatar
 
Join Date: 09 2001
Location: South Korea, Gumi
Posts: 7,699
Downloads: 102
Uploads: 34
Blog Entries: 16
Reputation: 561 | 6
Default

Спасибо за инфу, кстати очень полезный сайт.
Reply With Quote
Old 30.03.2003, 10:21   #4
freelancer
 
Yerkanian's Avatar
 
Join Date: 06 2002
Location: the same place
Posts: 592
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Default

outdated, acid...
Reply With Quote
Old 30.03.2003, 11:03   #5
В бой аргхххххххх!
 
hov's Avatar
 
Join Date: 09 2002
Location: Vik, Medieval Norway
Age: 35
Posts: 1,513
Downloads: 12
Uploads: 0
Reputation: 43 | 3
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
Reply With Quote
Old 31.03.2003, 10:54   #6
Moderator
 
Join Date: 03 2002
Location: Russia
Posts: 123
Downloads: 0
Uploads: 0
Reputation: 0 | 0
Default

hov
Это все написано в мануале. Не цитировать же его тут целиком.
Reply With Quote
Old 31.03.2003, 12:18   #7
В бой аргхххххххх!
 
hov's Avatar
 
Join Date: 09 2002
Location: Vik, Medieval Norway
Age: 35
Posts: 1,513
Downloads: 12
Uploads: 0
Reputation: 43 | 3
Default

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

Eto vopros ne ko mne....
i po-moemu voobshe ne k mestu
Reply With Quote
Sponsored Links
Reply

Thread Tools


На правах рекламы:
реклама

All times are GMT. The time now is 19:47.


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