App: manual - Page: fragments/expressions_32
App: manual - Page: fragments/expressions_39
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: data/a_list_keeps_the_commas_inside_its_strings_and_calls
PHP
|
HTML
data/a_list_keeps_the_commas_inside_its_strings_and_calls.pad
|
Result
|
|
{data 'l'}('a, b', "c, d", max(1, 7), 3 * 2){/data} [{l}{$l};{/l}]
|
|
App: regression/framework - Page: expressions/a_fraction_after_a_comma_is_a_number
PHP
|
HTML
expressions/a_fraction_after_a_comma_is_a_number.pad
|
Result
|
|
{echo php:json_encode([1, .5, .25])} {echo php:max(1, .5)} {echo php:implode('|', [.5,.25])}
|
|
App: regression/framework - Page: expressions/a_pipe_in_brackets_after_a_call_with_arguments_runs_every_part
PHP
|
HTML
expressions/a_pipe_in_brackets_after_a_call_with_arguments_runs_every_part.pad
|
Result
|
|
{echo (mid('hello', 1, 2) | ucfirst)} {echo (php:max(1, 2, 3) | + 1)} {echo upper(('ab' | replace('a', 'x')))} {echo ('x' | left(2) | . '!')}
|
|
App: regression/framework - Page: expressions/a_pipe_inside_brackets_belongs_to_the_group
PHP
|
HTML
expressions/a_pipe_inside_brackets_belongs_to_the_group.pad
|
Result
|
|
{set $n = 3/}{set $s = 'ab'/}[{echo ($n | + 1) * 2}][{echo upper(' hi ' | trim)}][{if ($n | + 1) eq 4}y{/if}][{echo php:max(1, $n | + 1)}][{echo php:implode(',', [$n | + 1, $n])}][{$s | php:str_pad(@ | upper, 4, '*')}][{echo $s | (@ | upper) . @}][{echo ($n | (@ | * 2))}]
|
|
App: regression/framework - Page: expressions/a_sign_before_a_field_a_group_or_a_call_negates_it
PHP
expressions/a_sign_before_a_field_a_group_or_a_call_negates_it.php
|
HTML
expressions/a_sign_before_a_field_a_group_or_a_call_negates_it.pad
|
Result
|
<?php
$a = 5; $b = 3; $n = 2; $neg = -4;
?>
|
[{echo 5 * -$b}][{echo $a - -$b}][{echo 5 * -(1 + 2)}][{echo 10 / -$n}][{echo 2 ** -$n}] [{echo 5 * - 3}][{echo 2 - - 3}][{echo 3 - -$n * 2}][{echo 5 * -php:abs(3)}][{echo 1 + +$b}] [{echo 10 | * -$n}][{echo 'abcdef' | substr(-$n)}][{echo 'abcdef' | substr(1, -$n)}][{echo php:max(1, -$n)}] [{if $neg gt -$b}T{else}F{/if}][{echo -$b}][{echo 10 | - 3}]
|
|
App: regression/framework - Page: expressions/a_trailing_comma_and_a_value_borrowed_from_the_pipe_in_brackets_stand
PHP
|
HTML
expressions/a_trailing_comma_and_a_value_borrowed_from_the_pipe_in_brackets_stand.pad
|
Result
|
|
[{echo php:max(1, 2,)}][{echo [1, 2, ] | php:count}][{echo 5 | (eq 5)}][{echo 5 | (1 eq)}][{echo (1 | + 1)}][{echo (1 | '-1')}]
|
|
App: regression/framework - Page: expressions/an_echo_that_starts_with_a_list_pipes_the_list
PHP
|
HTML
expressions/an_echo_that_starts_with_a_list_pipes_the_list.pad
|
Result
|
|
[{echo [3,1,2] | php:max}][{echo php:explode(',', 'a,b') | php:count}][{echo [1,2,3] | php:count}][{echo [1,2] | php:json_encode}]
|
|
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')}]
|
|
|