[OpenSIPS-Users] best way to do "foreach"

Liviu Chircu liviu at opensips.org
Wed May 12 10:46:52 EST 2021


On 12.05.2021 13:32, Kingsley Tart wrote:
>          $var(valindex) = $var(valindex) + 1;

Also worth mentioning that since 3.1, this statement can be re-written as:

	$var(valindex) += 1;

Additionally, during your iteration, you may also take advantage of the fact that "$(var(valCSV){csv.param,$var(valindex)})" returns NULL on "index out of bounds".  Many other "indexable" transformations behave like this as well.

-- 
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com
OpenSIPS eBootcamp 2021 | www.opensips.org/training




More information about the Users mailing list