SHARE
TWEET

Untitled

a guest Aug 22nd, 2017 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $value = array("name"=>"test", "age"=>"00");
  2.    
  3. $getValue = new <classname>;
  4. $getValue->value..
  5.    
  6. $object = new classname;
  7. $name = $object->value["name"];
  8. $age = $object->value["age"];
  9.  
  10. // Or you can use foreach, getting both key and value
  11. foreach ($object->value as $key => $value) {
  12.     echo $key . ": " . $value;
  13. }
  14.    
  15. $getValue = new yourClass();
  16. $getValue->value['name'];
  17.    
  18. foreach($getValue->value as $key=>$value)
  19.    
  20. <?php
  21.         interface Nameable {
  22.             public function getName($i);
  23.             public function setName($a,$name);
  24.         }
  25.         class Book implements Nameable {
  26.             private $name=array();
  27.             public function getName($i) {
  28.                 return $this->name[$i];
  29.             }
  30.             public function setName($i, $name) {
  31.                 return $this->name[$i] = $name;
  32.             }
  33.         }
  34.  
  35.         $interfaces = class_implements('Book');
  36.  
  37.         if (isset($interfaces['Nameable'])) {
  38.             $bk1 = new Book;
  39.             $books = array('bk1', 'bk2', 'bk3', 'bk4', 'bk5');
  40.             for ($i = 0; $i < count($books); $i++)
  41.                 $bk1->setName($i, $books[$i]);
  42.             for ($i = 0; $i < count($books); $i++)
  43.                 echo '// Book implements Nameable: ' . $bk1->getName($i) . nl();
  44.         }
  45. ?>
RAW Paste Data
Top