Mysterious PHP command

Posted on 2007-09-27
Last Modified: 2008-02-01
I am looking for a detailed procedulre for using -> in PHP.

I know it is used somehow in the calling of functions and assigning variables? but I cannot find docs on it anywhere.

Example would be.


or something like that.

Question by:lexshine
    LVL 24

    Accepted Solution

    The '->' operator allows you to call a method or access a member of an object. A good place to begin learning about objects is:

    Here is a brief example:


    class MyClass
       var $myValue = "This is my value.";

    $classInstance = new MyClass;

    echo $classInstance->myValue; // Output: "This is my value."

    LVL 1

    Expert Comment

    I was doing the same research earlier and took awhile before i came by this BASIC tutorials that will help everyone understanding it.
    LVL 4

    Expert Comment



    /// tutorial 2
    // function definitions ----------------------------------------------
    class PDF extends FPDF
    //Page header
    function Header()
        //Arial bold 15
        //Move to the right
        //Line break

    //Page footer
    function Footer()
        //Position at 1.5 cm from bottom
        //Arial italic 8
        //Page number
        $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');

    // now the content  ----------------------------------------------

    //Instanciation of inherited class
    $pdf=new PDF();
        $pdf->Cell(0,10,'Printing line number '.$i,0,1);

    where you saw that ?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Suggested Solutions

    Title # Comments Views Activity
    PHP Radio Array 4 27
    Question to locate the problem 18 26
    Where is the title coming from 6 34
    GPS save in database 19 20
    Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
    Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit ( and similar technologies have enjoyed wide adoption, making it possib…
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to dynamically set the form action using jQuery.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now