Search
 
SCRIPT & CODE EXAMPLE
 

PHP

What does this mean in PHP: -> or =>

The double arrow operator, =>, is used as an access mechanism for arrays. This means that what is on the left side of it will have a corresponding value of what is on the right side of it in array context. This can be used to set values of any acceptable type into a corresponding index of an array. The index can be associative (string based) or numeric.

$myArray = array(
    0 => 'Big',
    1 => 'Small',
    2 => 'Up',
    3 => 'Down'
);

The object operator, ->, is used in object scope to access methods and properties of an object. It’s meaning is to say that what is on the right of the operator is a member of the object instantiated into the variable on the left side of the operator. Instantiated is the key term here.

// 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();
Comment

what does ? mean in PHP

/* 
in php, ? is the 'Ternary Operator'.

The expression (expr1) ? (expr2) : (expr3) evaluates 
to expr2 if expr1 evaluates to true, and expr3 if 
expr1 evaluates to false.

It is possible to leave out the middle part of the 
ternary operator. Expression expr1 ?: expr3 evaluates 
to the result of expr1 if expr1 evaluates to true, 
and expr3 otherwise. expr1 is only evaluated once in 
this case.
*/

<?php
// Example usage for: Ternary Operator
$action = (empty($_POST['action'])) ? 'default' : $_POST['action'];

// The above is identical to this if/else statement
if (empty($_POST['action'])) {
    $action = 'default';
} else {
    $action = $_POST['action'];
}
?>
Comment

what does >= mean in php

//>= Stands for greater than or equal to.
$a = 1;
$b = 0;
  if($a >= $b){
   return true; 
  }else{
   return false; 
  }
//This would return false becaue 0 is not greater than or equal to 1.
Comment

PREVIOUS NEXT
Code Example
Php :: how to do taxonomy filter in wordpress 
Php :: define value in php 
Php :: function with parament php 
Php :: calculate 1 day interest 
Php :: order item add hook WooCommerce admin panel 
Php :: return true false laravel 
Php :: get all weeks in month php 
Php :: php artisan migrate error 
Php :: tackel discount in javascript 
Java :: minecraft death counter 
Java :: import android.support.v7.app.appcompatactivity error 
Java :: processing angle between two pvector 
Java :: marker annotations in java 
Java :: what are the hibernate dependencies 
Java :: javafx get screen size 
Java :: handler delay android 
Java :: Cannot resolve class android.support.design.widget.AppBarLayout 
Java :: javafx tableview clear all data 
Java :: java selenium open new tab 
Java :: java remove first character from string 
Java :: java cast duration to long 
Java :: java choose random enum 
Java :: java add commas to numbers 
Java :: java measure execution time 
Java :: How to connect java class file to xml file 
Java :: java jpanel message error messages 
Java :: fullscreen java jframe 
Java :: find area of trapezoid with sides only in java 
Java :: spring create bean only if another bean does not exists 
Java :: How to efficiently count the number of smaller elements to the right of every array element, in Java? 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =