Documentation incomplete
Hi there,
this is just a part of how explode works (and actually the more bizarre).
The docs don't state it also works as a normal PHP explode, this is the actual code from Exponential:
if ( $isString )
{
$result = explode( $matchParam, $inParam );
}
else if( $isArray )
{
$result = array( array_slice( $inParam, 0, $matchParam ), array_slice( $inParam, $matchParam ) );
}
Therefore if we have a string we can do the following: {$myString|explode("\n")} and we'll get an array split by the parameter I wrote in the string.
...and if we use implode subsequently we can obtain a string with the spaces replaced for example, without having to install the ezstr_replace extension (which is not supported on ez4).
Max
Comments (1 historical)
Written by readers of the earlier documentation sites, kept as they were.
Re: Documentation incomplete
Svitlana Shatokhina ·
http://ez.no/doc/ez_publish/techn...e/template_operators/strings/explode