decode entities

Prev Next

Function Names

decode entities

Description

This function decodes character entities entities (like € &#20ac; €) into actual characters.

Note: Character entities specified as string constants inside single quotation marks (as softquoted strings) in the B4P code will be converted automatically, quasi at compile time, and do not reuqire this function to be called.

Call as: function

Restrictions

Indirect parameter passing is disabled

Parameter count

1

Parameters

No.TypeDescription
1
input
string input string

This string contains entity-encoded special characters

Return value

TypeDescription
string String with decoded characters

Converted string with decoded characters

Exceptions

Invalid character code (outside 0 - 1114111 range)

Examples

      echo( decode entities( "4.50 € / 4.50 € / 4.50 € / 4.50 €" ) );
      echo( "4.50 €" ); // Quoted string are not decoded.
      echo( '4.50 €' ); // Softquoted string is already decoded implicitly.
      echo( '4.50 &eur' + 'o;' ); // This one is not because full entity is not in one softquoted string value

Output

4.50 € / 4.50 € / 4.50 € / 4.50 €
4.50 €
4.50 €
4.50 €
Try it yourself: Open LIB_Function_decode_entities.b4p in B4P_Examples.zip. Decompress before use.

See also

chr
encode entities