Answers for "-> in php"

PHP
5

-> 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();
Posted by: Guest on April-06-2020
7

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'
);
Posted by: Guest on December-16-2019
1

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()'
Posted by: Guest on June-24-2021
0

-> 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();
Posted by: Guest on December-01-2020

Browse Popular Code Answers by Language