Skip to the content
Documentation

strtok

No ratings yet

Available since Exponential 6.0.13.

Summary

strtok( string, token ) — token required Note: PHP strtok is stateful. In a template this returns the first token only. Subsequent {strtok(token)} calls without a string will continue tokenizing.

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

Source

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

See also

Generated example: strtok

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.