0

Hi,
I have some basic php knowledge. I want to know about ' -> ' sign. What does this arrow means? I know it is very sipmle question but don't know. I am learning php from my own effort.

Jahur

3
Contributors
3
Replies
5
Views
4 Years
Discussion Span
Last Post by rubai
1

An example is an array, where you define keys:

$myArray = array("name" => "John", "street" => "long street");

Just saw that you asked about -> and not => :-)

-> is used when you are dealing with classes and objects:

class foo
{
    function do_foo()
    {
        echo "Doing foo."; 
    }
}

$bar = new foo;
$bar->do_foo();

Take a look at this side, and use the code in your own script, as a practise, and see what is being output to the screen, would be the best practice, to just jump into it :-)

Reference: http://php.net/manual/en/language.types.object.php

Klemme

Edited by klemme

Votes + Comments
Thank you so much much klemme. You really understand me. Really thanks
0

what i understand by the ' -> ' symbol you are trying to figure out, must be how you call a method of a function using its object.

$dbname="xyz";
$ob=new common_function();
$connect=$ob->db_connect($dbname);

0

Thanks Klemme. You give me a detailed concept.Also thanks for the referrence link.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.