-3
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']);
-3
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']);
5
I don’t think you need to put the echo
, try to do it that way:
$out = array('success'=>false,'error'=>'You dont have coins! You have'.$user['xxx']);
Also try double quotes instead of single quotes:
$out = array('success'=>false,'error'=>"You dont have coins! You have {$user['xxx']}");
0
There are 2 errors in this code, and there is a echo
in the string, elseif tag closure 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
?>
Observing: Utilise
$user['xxx']
inside a double-quoted string will generate an error. The correct is${user['xxx']}
or{$user['xxx']}
. Note the use of keys.
actually had more stuff down, and this ] was down. I didn’t put the whole code just this part.
Browser other questions tagged php code-review
You are not signed in. Login or sign up in order to post.
Always provide as much information as possible so that people can help you. In addition to the code that is generating the error, you should also post the error that was generated.
– Bruno Rigolon