-> in php
// Create a new instance of MyObject into $obj
$obj = new MyObject();
// Set a property in the $obj object called thisProperty
$obj->thisProperty = 'Fred';
// Call a method of the $obj object named getProperty
$obj->getProperty();
-> in php
// Create a new instance of MyObject into $obj
$obj = new MyObject();
// Set a property in the $obj object called thisProperty
$obj->thisProperty = 'Fred';
// Call a method of the $obj object named getProperty
$obj->getProperty();
php =>
PHP =>
//The double arrow operator, =>
//Used as an access mechanism for arrays.
//The left side will have a corresponding value on the right side in array.
//This can be used to set values into a corresponding index of an array.
//The index can be a string or number.
$myArray = array(
0 => 'Red',
1 => 'Orange',
2 => 'Yellow',
3 => 'Green'
);
using -> in php
//The -> operator, also known as the object operator is used to access the properties and methods for a specific object.
// Besides, in simple words, the object operator -> is responsible for accessing an object method.
// for example: you a class 'Point' with a 'calculatePoint' method
$obj = new Point();
// setting a property of the Point class
$obj->x = 'value';
$obj->y = 'value';
// Calling a any method from our $obj
$obj->calculatePoint();
// Same implementation in Python
pyoObj = Point()
pyObj.x = 'value'
pyObj.y = 'value'
pyObj.calculatePoint()
// you should have something like that in most languages,
// I mean the '.propery()' instead of '->property()'
-> in php
// Create a new instance of MyObject into $obj
$obj = new MyObject();
// Set a property in the $obj object called thisProperty
$obj->thisProperty = 'Fred';
// Call a method of the $obj object named getProperty
$obj->getProperty();
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us