php =>
snippet in php

php =>

user7889

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'
);

-> in php

user2209

// 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 array

user6449

$array = ['cheese', 'ham', 'potato'];

var_dump($array);

tab php

user9641

$tab = array(); // empty tab
$tab = array("0" => "Hello", "1" => "world"); // $tab[0]="hello" and $tab[1]="world"