Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 6th, 2012  |  syntax: None  |  size: 0.23 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Access property value as string literal in PHP
  2. print($phpObject->id);  // Okay
  3.        
  4. $propertyName = 'id';
  5. print($phpObject[$propertyName]);
  6. print($phpObject["id"]);
  7.        
  8. $propertyName = 'id';
  9.  
  10. print($phpObject->{$propertyName});