Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $value = array("name"=>"test", "age"=>"00");
- $getValue = new <classname>;
- $getValue->value..
- $object = new classname;
- $name = $object->value["name"];
- $age = $object->value["age"];
- // Or you can use foreach, getting both key and value
- foreach ($object->value as $key => $value) {
- echo $key . ": " . $value;
- }
- $getValue = new yourClass();
- $getValue->value['name'];
- foreach($getValue->value as $key=>$value)
- <?php
- interface Nameable {
- public function getName($i);
- public function setName($a,$name);
- }
- class Book implements Nameable {
- private $name=array();
- public function getName($i) {
- return $this->name[$i];
- }
- public function setName($i, $name) {
- return $this->name[$i] = $name;
- }
- }
- $interfaces = class_implements('Book');
- if (isset($interfaces['Nameable'])) {
- $bk1 = new Book;
- $books = array('bk1', 'bk2', 'bk3', 'bk4', 'bk5');
- for ($i = 0; $i < count($books); $i++)
- $bk1->setName($i, $books[$i]);
- for ($i = 0; $i < count($books); $i++)
- echo '// Book implements Nameable: ' . $bk1->getName($i) . nl();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement