Playing cards: Difference between revisions

Content added Content deleted
m (→‎version 2: added more whitespace to the output. -- ~~~~)
m (→‎{{header|PHP}}: Removed redundant Deck::__toString() and added convenience method CardCollection::toString())
Line 2,162: Line 2,162:
}
}


// use this method to iterate cards
public function toArray()
public function toArray()
{
{
Line 2,167: Line 2,168:
}
}


public function __toString()
public function toString()
{
{
return implode( ' ', $this->cards );
return implode( ' ', $this->cards );
}

public function __toString()
{
return $this->toString();
}
}


Line 2,211: Line 2,217:
{
{
shuffle( $this->cards );
shuffle( $this->cards );
}

public function __toString()
{
return implode( ' ', $this->cards );
}
}
}</lang>
}</lang>