coop Posted February 1, 2007 Share Posted February 1, 2007 Hi all, I'm more use to ActionScript, so I'm getting a little confused with php syntax. What does the "->" mean is this same as the dot syntax in ActionScript where you would write "this.paypal_post_vars = $paypal_post_vars" function paypal_ipn($paypal_post_vars)} $this->paypal_post_vars = $paypal_post_vars; $this->timeout = 120; } Link to comment https://forums.phpfreaks.com/topic/36614-solved-help-with-syntax/ Share on other sites More sharing options...
HuggieBear Posted February 1, 2007 Share Posted February 1, 2007 It's similar yes, it's reference to the calling object. $this is a special variable that's used within classes. Here's some light reading for you http://uk.php.net/manual/en/language.oop5.basic.php Regards Huggie Link to comment https://forums.phpfreaks.com/topic/36614-solved-help-with-syntax/#findComment-174463 Share on other sites More sharing options...
JasonLewis Posted February 1, 2007 Share Posted February 1, 2007 when using the -> it is refering to a CLASS. that function would be part of a class. so when calling $this->paypal_post_vars you are setting the variable paypal_post_vars in your class to $paypal_post_vars. it would look like this: class Paypal { //just a made up name public $paypal_post_vars = ""; public $timeout = ""; function paypal_ipn($paypal_post_vars){ $this->paypal_post_vars = $paypal_post_vars; $this->timeout = 120; } } and i just noticed an error, on the function like you have a }. it should be the other direction { Link to comment https://forums.phpfreaks.com/topic/36614-solved-help-with-syntax/#findComment-174464 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.