I have used some code from this blackjack game to build my own full version.
Everything works perfectly locally using Xampp, but when I uploaded the full version I get: expects parameter to be array, boolean given.
I'm very new to PHP, but from what I understand, I have defined the array. Why is it giving me a boolean online, and array offline?
Here is the full game I wrote.(the site is a little NSFWish, but the page is clean)
The problem seems to be from here:
function evaluateHand($hand) {
$Ace=0;
global $faces;
$value = 0;
foreach ($hand as $card) {
if ($card['face'] == 'Ace')
$Ace++;
$value = intval($value) + intval($faces[$card['face']]);
while ($Ace>0 && $value >21)
{
$value = intval($value) - 10;
$Ace--;
}
}
specifically the - foreach ($hand as $card) { part.
I do remember reading someone else having the same problem, and the solution seemed to be switiching from double to single quotations here.
<input type='hidden' name='handstr' value = '<?php echo $handstr ?>' />
but I already have single quotations.
What really confuses me, is the guy who wrote the script seems to have it running fine.
If you change the .PHP to .txt you can see the full game code (from link above... sorry 2 link max)
Anyone know why offline would be different from online, and how to fix the problem?