In PHP,
- I have already understood that double arrow(=>) is used with arrays to assign a value to the key.
- And object operator(->) is used to access the properties of objects(methods and variables).
Take a look at my code in controller.Here test is the name of the model and display is the view.
public function show()
{
$Items=test::all();
return view('display'[ 'Item'=>$Items]);
}
- Could anyone explain what exactly the double arrow(=>) operator is doing here and how it is possible?
And below is a code section in display view
<?php
foreach($Item as $value){
?>
<tr>
<td><?php echo $value->ItemName ?><\td>
\\some more columns are there
- As per the definition the left side of the object operator(->) must be an instance variable.Then how this operator is applicable here?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire