App: manual - Page: fragments/expressions_32
App: manual - Page: fragments/expressions_43
PHP
|
HTML
fragments/expressions_43.pad
|
Result
|
|
{set $scores = [7, 9, 4, 10]} <p>Sum {echo array:scores + 0}, count {echo php:count(array:scores)}</p> <p>Average {echo (array:scores + 0) / php:count(array:scores)}</p> <p>Best {echo php:max(array:scores)}, worst {echo php:min(array:scores)}</p> <p>{echo php:implode(', ', array:scores)}</p>
|
|
App: regression/framework - Page: expressions/an_infix_test_as_an_argument_of_a_call_is_that_argument
PHP
|
HTML
expressions/an_infix_test_as_an_argument_of_a_call_is_that_argument.pad
|
Result
|
|
{set $n = 3}{set $s = 'ab'}[{echo php:var_export($n in (5), 1)}][{echo php:strval($n in (3))}][{echo php:max(1, $n + 1 in (4))}][{echo php:var_export($n not in (5), 1)}][{echo php:var_export(php:substr($s, 0, 1) like 'a%', 1)}][{echo php:str_repeat('x', $n in (3) ? 2 : 1)}][{echo $s | replace('a', $n in (3))}][{echo php:max(php:min(4, 9), $n range (1, 5))}][{echo php:max(1, in (3))}]
|
|
App: regression/framework - Page: expressions/an_inline_ternary_as_an_argument_is_that_argument_only
PHP
|
HTML
expressions/an_inline_ternary_as_an_argument_is_that_argument_only.pad
|
Result
|
|
{set $n = 5}{set $s = 'banana'}{set $z = 0}[{echo $s | replace('a', $n gt 1 ? 'x' : 'y')}][{echo php:str_repeat('-', $n gt 0 ? $n : 1)}][{echo php:str_repeat($n gt 0 ? '+' : '-', 3)}][{echo php:max($n gt 3 ? 1 : 9, $z ? 4 : 2)}][{echo php:max($z ? 1 : php:min(8, 7), 3)}][{echo php:implode('-', [1, $n gt 3 ? 2 : 0, 3])}][{echo $s | replace('a', $n gt 9 ? 'x' : $n gt 4 ? 'm' : 's')}]
|
|
|