if(count($items) > 1) {
$out = array('success'=>false,'error'=>'You choose more bots');
} elseif($user['balance'] < $sum) {
$out = array('success'=>false,'error'=>'You dont have coins! You have' echo $user['xxx']);
if(count($items) > 1) {
$out = array('success'=>false,'error'=>'You choose more bots');
} elseif($user['balance'] < $sum) {
$out = array('success'=>false,'error'=>'You dont have coins! You have' echo $user['xxx']);
I do not think you need to put echo
, try doing it this way:
$out = array('success'=>false,'error'=>'You dont have coins! You have'.$user['xxx']);
Also try double quotation marks instead of single quotation marks:
$out = array('success'=>false,'error'=>"You dont have coins! You have {$user['xxx']}");
There are 2 errors in this code, besides there is a echo
in the string, the closure of the elseif tag is also missing. After $sum)
has the opening {
, but the closing - > }
is missing. The correct code would be:
<?php
if( count($items) > 1)
{
$out = array(
'success' => false,
'error' => 'You choose more bots'
);
}
elseif($user['balance'] < $sum)
{
$out = array(
'success' => false,
'error' => "You dont have coins! You have ${user['xxx']}" // <-- Estava escrito de maneira incorreta
);
} // <-- Estava faltando
?>
Note : Using
$user['xxx']
inside a double-quoted string will generate an error. The correct one is${user['xxx']}
or{$user['xxx']}
. Note the use of the keys.