Skip to the content
Documentation

hex2bin

No ratings yet

Available since Exponential 6.0.13.

Summary

Returns false on invalid input; suppress PHP's E_WARNING for odd-length or non-hex strings so the template doesn't crash.

Description

PHP string function operators for Exponential templates.

Provides template access to PHP string functions documented at
https://www.php.net/manual/en/ref.strings.php that are NOT already
covered by existing Exponential template operators.
The piped input value maps to the primary string argument of each PHP
function. Additional template parameters map to the remaining PHP arguments
in left-to-right positional order.
The following operators are intentionally NOT implemented in this class
because they are already available as built-in Exponential template operators:
  chr, ord, trim, nl2br, rot13/str_rot13, crc32, md5, sha1, concat,
  indent, upcase/strtoupper, downcase/strtolower, count_chars (mb_strlen),
  count_words, break (nl2br), wrap/wordwrap, shorten, pad/str_pad,
  upfirst/ucfirst, upword/ucwords, simplify, wash/htmlspecialchars,
  append, prepend, merge, contains, compare, extract, extract_left,
  extract_right, begins_with, ends_with, implode, explode,
  repeat/str_repeat, reverse/strrev, insert, remove, replace, unique,
  array_sum.
Creative additions:
- ristring: str_replace(search, replace, subject) — case-sensitive replace
- rstring:  str_ireplace(search, replace, subject) — case-insensitive replace

Examples

{$str|hex2bin}

Source

Implemented by eZTemplateStringsOperator (lib/eztemplate/classes/eztemplatestringsoperator.php).

See also

Generated example: hex2bin

Added to the reference for Exponential 6.0.15: the 4.x reference had no page for this operator.

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.