Reference - Parms functions - onceCall


App: regression/framework - Page: expressions/the_expression_of_echo_if_case_and_while_runs_once
PHP
expressions/the_expression_of_echo_if_case_and_while_runs_once.php
HTML
expressions/the_expression_of_echo_if_case_and_while_runs_once.pad
Result
<?php

// The expression of {echo}, {if}, {case} and {while} runs once: it was evaluated when the
// parameters were read and again by the tag, so a PHP call in it ran twice.

$calls = 0;

function
onceCall () { return ++ $GLOBALS ['calls']; }

?>
{echo php:onceCall()}{if php:onceCall() gt 0}{/if}{case php:onceCall()}{when 3}{/case}{while php:onceCall() lt 0}{/while} {$calls}