Log in

View Full Version : why this symbol used?



gurmeet
01-18-2010, 06:26 AM
i found this in a coding.....

$this->${title}



why to use {} braces in front of title?

i never used this symbol in my code?


what is the purpose of this symbol?

Nile
01-18-2010, 11:29 PM
Well, first you may want to check out this (http://www.dynamicdrive.com/forums/showthread.php?t=29528) thread.

Now, to understand the above - you must understand the define() (http://us.php.net/define) function. My explanation was stupid, so it's replaced with this:

Yeah. Say it's called a constant, it's kind of like a variable in the sense that it stores data, however, once the data is set, it cannot be changed, the data can be only be scalar, and it is accessed differently.
So:


<?php
define("hello", "How are you today?");
echo ${hello};
?>

Would return:

How are you today?

traq
01-19-2010, 02:29 AM
Well, first you may want to check out this (http://www.dynamicdrive.com/forums/showthread.php?t=29528) thread.

^ that's freakin' COOL. Makes all the experimenting I did last night useless, but oh well. :D

gurmeet
01-21-2010, 12:55 PM
make it more clear

Nile
01-21-2010, 12:59 PM
It will never get more clear - sorry.

gurmeet
01-21-2010, 01:12 PM
:(:confused:

gurmeet
01-21-2010, 01:13 PM
ok as u wish

Nile
01-21-2010, 01:15 PM
Check out this thread: http://www.dynamicdrive.com/forums/showthread.php?t=29528
And this link: http://us2.php.net/manual/en/language.variables.variable.php

gurmeet
01-21-2010, 01:29 PM
its better
thnx:)