Jump to content

can someone explain what -> is


JustinB

Recommended Posts

 

$obj->method(); = a method call

 

A method = a function of an object

A object = a collection of methods/functions (among other things)

 

<?php
//A function
function my_function {
    print 'hi';
}

//Run function
my_function();

//A class with a function (called a method)
class my_object {
    function my_method() {
        print 'hi';
    }
}
$obj = new my_object;

//Run method
object->my_method();

?>

 

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.