lucerias Posted November 1, 2006 Share Posted November 1, 2006 May i know what is the meaning of the following code and what does -> mean? Thank you.$focus = new Customer(); $xtpl->assign("ACCOUNT_ID", $focus->account_id) Link to comment https://forums.phpfreaks.com/topic/25792-php-syntax-problem/ Share on other sites More sharing options...
Cep Posted November 1, 2006 Share Posted November 1, 2006 From what I can quickly gather,$focus is a new instance of the object Customerand the next line is calling the function assign from the class $xtpl and doing something to it with the string "account_id" and and unknown object/var/function from class $focus Link to comment https://forums.phpfreaks.com/topic/25792-php-syntax-problem/#findComment-117780 Share on other sites More sharing options...
lucerias Posted November 8, 2006 Author Share Posted November 8, 2006 Then what does this "$xtpl->" about? Assign("ACCOUNT_ID", $focus->account_id) can be done independently? Thank you. Link to comment https://forums.phpfreaks.com/topic/25792-php-syntax-problem/#findComment-121369 Share on other sites More sharing options...
Cep Posted November 8, 2006 Share Posted November 8, 2006 it basically means you are using a function, variable or whatever from the class $xtpl for example you might write two functions with the same name but stick on of those functions under the $xtpl class which does something differently so instead of calling,[code=php:0]$myvar = resultofmyfunction("pudding");echo $myvar; // "pudding"[/code]You can also call your class version of that function[code=php:0]$myvar = $xtpl->resultofmyfunction("pudding");echo $myvar; // "No more pudding"[/code]** Step in guys if you see a mistake here I dont really use classes much myself ** Link to comment https://forums.phpfreaks.com/topic/25792-php-syntax-problem/#findComment-121453 Share on other sites More sharing options...
lucerias Posted November 10, 2006 Author Share Posted November 10, 2006 Sorry guys, i still can't get it, why we need $xtpl? Can you guys tell me based on your what you understand? Thank you. Link to comment https://forums.phpfreaks.com/topic/25792-php-syntax-problem/#findComment-122442 Share on other sites More sharing options...
Zane Posted November 10, 2006 Share Posted November 10, 2006 $xtpl is an object of something you have declared earlier in the code.....or even in an included filesomewhere, either above this snippet or in an included file you have said something along the lines of$xtpl = new Something;and then in the snippet you're making a variable out of the return of a function from that class$myvar = $xtpl->resultofmyfunction("pudding");meaning somewhere in the Something classyou have a function named resultofmyfunction Link to comment https://forums.phpfreaks.com/topic/25792-php-syntax-problem/#findComment-122460 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.