I'm not sure where you think you're going, but your code is jacked up all over the place.
First, private variables must be accessed via $this-> , not just calling them.
Second, "suits" is spelled wrong (not a code problem, but worth knowing).
Third, Ace & 1 are the same card.
Fourth, whatever you think createDeck is doing, you're wrong. Take a closer look at that routine.
Fifth, you can't just count from 1 to 52 and expect $this->suits[$i] or $this->cardValues[$i] to have any value.
I have no idea where your memory error is coming from, but I doubt it's the code you've shown us here. What you're seeing is a symptom of another problem. The symptom shows itself here, but the problem is that something is using 33mb of memory -- that thing is likely elsewhere in your script, so you'll need to do some tracking there to figure it out.
General advice: Don't just sit down and code. Take the time to model things out on paper first. Sketch a few examples. Then, when you do sit down to code you'll have something more than a general idea of where you're going and what needs to be done to get there. createDeck would never have been written the way you have if you had first tried to figure out how to create all 52 cards given 13 numbers and 4 suits by hand.
OOPS. Meant to add this in to help you get started, but createDeck is left for you as an exercise.
PHP Code:
<?php
class Deck {
// Members
private $shuffledDeck;
private $deck;
private $cardsLeft = 0;
private $suits = array(
0=> 'Hearts',
1=> 'Diamonds',
2=> 'Spades',
3=> 'Clubs' );
private $cardValues = array(
0=> 'Ace',
1=> 1,
2=> 2,
3=> 3,
4=> 4,
5=> 5,
6=> 6,
7=> 7,
8=> 8,
9=> 9,
10=> 10,
11=> 'Jack',
12=> 'Queen',
13=> 'King' );
// Methods
public function getShuffledDeck() {
return $this->shuffledDeck;
}
public function shuffleDeck() {
}
public function createDeck() {
for( $i = 0; $count < 52; $i++ ) {
$this->deck[ $i ][ 0 ] = $this->cardValues[ $i%13 ];
$this->deck[ $i ][ 1 ] = $this->suits[ $i%4 ];
}
}
}
?>