# Why doesnt this work?

**URL:** <https://forum.kirupa.com/t/why-doesnt-this-work/221605>\
**Category:** Uncategorized\
**Created:** [April 5, 2007, 3:55pm UTC](https://forum.kirupa.com/t/why-doesnt-this-work/221605 "2007-04-05T15:55:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rschoenbach](https://avatars.discourse-cdn.com/v4/letter/r/7cd45c/32.png) [@rschoenbach](https://forum.kirupa.com/u/rschoenbach)\
**Post date:** [April 5, 2007, 3:55pm UTC](https://forum.kirupa.com/t/why-doesnt-this-work/221605/1 "2007-04-05T15:55:03Z")

</div>

```php
<?php
class card {
    private $cards;
    private $array;

    function setCard($val) {
        $this->cards = array_rand($val, 1);
        return;
    }
    function getCard() {
        return $this->cards;
    }
    function deleteCard($val) {
        $this->array = unset($val[$this->getCard()]);
        return;
    }
}
$randomcard = new card;

$cards = array("Spade" => 1, "Clubs" => 2, "Diamonds" => 3, "Hearts" => 4);

$randomcard->setCard($cards);
$randomcard->deleteCard($cards);
echo $randomcard->getCard();
?>

```

Also I need to figure out howto actually delete and return from the array I pass in. Any suggestions?
