Parse error: syntax error, Unexpected ''",>'' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';'

Asked

Viewed 997 times

0

I have error in the presentation of the code: introducing

Parse error: syntax error, Unexpected ''">' (T_CONSTANT_ENCAPSED_STRING) , expecting,' or ';'

the code referring the error is the second line, will have to help worth!

 echo   '<div class="letras">
                <label class="alternativa" for="'.$i+1.'" >'.$letras[$i].',
                    <input type="radio" name="1" id="'.$i+1.'" value="'.$numabcde[$i].'">'.$randabcde[$i].'
                </label>
            </div>
        }';

1 answer

3


Separate numeric expressions with ( ), otherwise concatenation happens before the mathematical operation.

Correction:

echo '<div class="letras">
                <label class="alternativa" for="'.($i+1).'" >'.$letras[$i].',
                    <input type="radio" name="1" id="'.($i+1).'" value="'.$numabcde[$i].'">'.$randabcde[$i].'
                </label>
            </div>
        }';

There are other oddities in your code, like a comma and a } remaining, but only for what was posted in the question, can not make idea of the original intention.

  • thanks for the support !

  • It would be nice to separate each line with its separate echo, or use echo only in place of variables.

  • 1

    @Fernandojunior if the answer solved the problem mark it as correct please. Thank you

Browser other questions tagged

You are not signed in. Login or sign up in order to post.