user3821280
user3821280

Reputation: 39

How to display unicode chars using php?

I'm currently using php and zend 2, and trying to display this specific char ✔. I've tried this way:

<?php echo '<td>' . ($fiche['statut']==1? &#10004; :'') . '</td>'; ?>

But, doing that I'm getting the following error message:

Parse error: syntax error, unexpected '&'

How to fix this, please ?

Thanks in advance!

Upvotes: 0

Views: 73

Answers (1)

Bart Friederichs
Bart Friederichs

Reputation: 33521

Add quotes:

<?php echo '<td>' . ($fiche['statut']==1? '&#10004;' :'') . '</td>'; ?>

Without the quotes, the PHP parser sees &#10004; as PHP code, which generates the syntax error.

Upvotes: 1

Related Questions