App: manual - Page: fragments/conditions_6
PHP
fragments/conditions_6.php
|
HTML
fragments/conditions_6.pad
|
Result
|
<?php
$count = 3; $heading = ''; $code = 'NL1234'; $state = 'pending';
?>
|
<p>{$count} {echo $count eq 1 ? 'item' : 'items'}</p> <p>Title: {$heading | ?? 'Untitled'} - subtitle: {echo $subtitle ?? 'none'}</p> <p>Code {$code} {if $code matches '/^[A-Z][A-Z][0-9]+$/'}is{else}is not{/if} well formed</p> <p>State {$state} {if $state in ('active', 'pending')}is open{else}is closed{/if}</p>
|
|
App: manual - Page: fragments/expressions_23
App: manual - Page: fragments/expressions_28
App: manual - Page: fragments/expressions_29
PHP
|
HTML
fragments/expressions_29.pad
|
Result
|
|
{data 'orders'} [ {"nr": 1, "state": "paid", "customer": "Ada"}, {"nr": 2, "state": "cancelled", "customer": "Alan"}, {"nr": 3, "state": "sent", "customer": "Bob"}, {"nr": 4, "state": "sent", "customer": "Alice"} ] {/data} {orders where='$state not in ("cancelled", "refunded") and $customer like "A%"'} <p>{$nr}: {$customer}, {$state}</p> {/orders}
|
|
App: manual - Page: fragments/expressions_36
App: regression/framework - Page: check/miscellaneous_in
PHP
|
HTML
check/miscellaneous_in.pad
|
Result
|
|
{if 5 in [7,9,4,2,9,6]} NOK @else@ ok {/if}
{if 4 in [7,9,4,2,9,6]} ok @else@ NOK {/if}
|
|
App: regression/framework - Page: expressions/a_date_object_tested_against_date_objects_takes_their_moments
PHP
|
HTML
expressions/a_date_object_tested_against_date_objects_takes_their_moments.pad
|
Result
|
|
{set $d = php:date_create('2020-01-02 03:04:05+00:00')}{set $e = php:date_create('2020-01-02 08:04:05+05:00')}{set $f = php:date_create('2020-01-03 00:00:00+00:00')}a[{if $d eq $e}eq{else}ne{/if}] b[{if $d in ($e)}in{else}notin{/if}] c[{if $d range ($e, $f)}r{else}nr{/if}] d[{if $f in ($d, 'x')}in{else}notin{/if}]
|
|
App: regression/framework - Page: expressions/a_not_after_an_operator_denies_the_value_after_it
PHP
|
HTML
expressions/a_not_after_an_operator_denies_the_value_after_it.pad
|
Result
|
|
{if 1 eq not 0}T{else}F{/if} [{echo ! not 0}] {if 'abc' lt '5' not in (1, 2)}T{else}F{/if} {echo 2 + not 0}
|
|
App: regression/framework - Page: expressions/a_not_between_a_value_and_its_test_denies_the_test
PHP
|
HTML
expressions/a_not_between_a_value_and_its_test_denies_the_test.pad
|
Result
|
|
{data 'rows'}[{"s":"a"},{"s":"b"},{"s":"c"}]{/data}{rows where='$s not in ("a", "b")'}{$s}{/rows}|{rows where='$s not like "a%"'}{$s}{/rows}|{if 5 not in (5, 6)}T{else}F{/if}|{rows}{if $s ne 'a' and $s not in ('b')}{$s}{/if}{/rows}|{rows}{if $s not matches '/^[ab]$/'}{$s}{/if}{/rows}|{if 5 not range (1, 4)}T{else}F{/if}|{if not 5 in (1)}T{else}F{/if}
|
|
App: regression/framework - Page: expressions/a_test_after_a_function_without_brackets_tests_its_answer
PHP
|
HTML
expressions/a_test_after_a_function_without_brackets_tests_its_answer.pad
|
Result
|
|
[{echo 'Hello' | lower in ('hello')}][{echo 'Hello' | lower in ('x')}][{echo 'abc' | php:strlen in (3)}][{echo 'ab ' | trim like 'ab'}]
|
|
App: regression/framework - Page: expressions/a_typed_reference_before_an_infix_test_is_its_input
PHP
|
HTML
expressions/a_typed_reference_before_an_infix_test_is_its_input.pad
|
Result
|
|
{set $n = 3/}{set $s = 'hello'/}[{if field:n in (4, 5)}y{else}n{/if}][{echo field:n in (1, 2, 3)}][{echo field:n not in (1, 2)}][{echo field:s like 'h%'}][{echo constant:PHP_INT_SIZE in (4, 8)}]
|
|
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_infix_test_takes_the_whole_arithmetic_on_its_left
PHP
|
HTML
expressions/an_infix_test_takes_the_whole_arithmetic_on_its_left.pad
|
Result
|
|
{set $n = 3}{set $p = 10}{set $q = 3}{set $s = 'ab'}[{if $n + 1 range (9, 9)}T{else}F{/if}][{echo $n + 1 range (4, 4)}][{if $p * $q in (30)}T{else}F{/if}][{if $s . 'c' like 'abc'}T{else}F{/if}][{if -$n in (-3)}T{else}F{/if}][{if $n + 1 not in (4)}T{else}F{/if}][{if upper($s) in ('AB')}T{else}F{/if}][{echo $n | * 2 in (6)}][{if $n eq 3 and $n + 1 in (4)}T{else}F{/if}][{if not $n + 1 in (4)}T{else}F{/if}]
|
|
App: regression/framework - Page: expressions/in_tests_membership_written_infix
PHP
expressions/in_tests_membership_written_infix.php
|
HTML
expressions/in_tests_membership_written_infix.pad
|
Result
|
<?php $x = "aaa"; $n = 5; $empty = ""; $zero = 0; ?>
|
[{if $x in ('aaa','b')}yes{else}no{/if}][{if $x in ('c','d')}yes{else}no{/if}]
|
|
App: regression/framework - Page: functions/a_list_parameter_is_taken_where_the_function_takes_one
PHP
|
HTML
functions/a_list_parameter_is_taken_where_the_function_takes_one.pad
|
Result
|
|
1[{echo 'abc' | replace(['a', 'b'], ['x', 'y'])}] 2[{echo 'abc' | cut(['a', 'c'])}] 3[{echo 'b' | in(['a', 'b'])}] 4[{echo [1, 2] | contains(2)}] 5[{echo '' | default(['x', 'y']) | php:count}] 6[{echo 'b' in ('a', 'b')}]
|
|
|