Parse error: syntax error, unexpected '' ", '' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';' [closed]

0

I'm having an error in submitting the code:

  

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

The code referring to the error is the second line, is it possible to help? Thanks!

 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>
        }';
    
asked by anonymous 02.08.2016 / 01:19

1 answer

3

Separate numeric expressions with ( ) , otherwise the concatenation happens before the math 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, such as a comma and a } , but only by what was posted in the question, you can not imagine the original intention.

    
02.08.2016 / 01:27