Help center

Caution: This documentation is for Exponential, from version 3.x to 6.x.
For 5.x documentation covering Platform see Exponential Platform Documentation, for difference between legacy and Platform see 5.x Architecture overview.

substr_replace

Available since Exponential 6.0.13.

Summary

substr_replace( string, replace, start [, length] ) — replace and start required

Description

PHP string function operators for Exponential templates.

Provides template access to PHP string functions documented athttps://www.php.net/manual/en/ref.strings.php that are NOT alreadycovered by existing Exponential template operators.
The piped input value maps to the primary string argument of each PHPfunction. Additional template parameters map to the remaining PHP argumentsin left-to-right positional order.
The following operators are intentionally NOT implemented in this classbecause 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|substr_replace("insert", 3)}

Source

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

See also

Generated example: substr_replace

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

Graham Brookins (05/11/2026 9:25 am)

Graham Brookins (05/11/2026 11:19 am)

Graham Brookins

No ratings yet