Jump to content

PHP syntax problem


lucerias

Recommended Posts

From what I can quickly gather,

$focus is a new instance of the object Customer

and 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

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

$xtpl is an object of something you have declared earlier in the code.....or even in an  included file

somewhere, 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 class
you have a function named resultofmyfunction
Link to comment
https://forums.phpfreaks.com/topic/25792-php-syntax-problem/#findComment-122460
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.