php - Defining variable in a class -
i new php, , i'm getting undefined variable $firstdect
though defined:
class deck { public function getdeck() { $firstdeck = new deck(); return $this->firstdeck; } }
and,
<div class="panel-body"> <?php foreach ($firstdeck->getdeck() $card): ?> <img class="col-md-3" src="<?php echo $card->getimage(); ?>"> <?php endforeach; ?> </div>
class deck { /* have define variable below before accessing $this->firstdeck */ public $firstdeck; public function getdeck() { $this->firstdeck = new deck(); return $this->firstdeck; } }
read more here
Comments
Post a Comment