Reference - PAD functions - range


App: manual - Page: fragments/conditions_2
PHP
HTML
fragments/conditions_2.pad
Result
{set $age = 35/}
<p>{if $age range (18, 65)}Working age.{/if}</p>
<p>{if $age gt 30 and $age lt 40}In the thirties.{/if}</p>
<p>{if $age lt 18 or $age gt 65}Not working age.{else}Still is.{/if}</p>


App: manual - Page: fragments/expressions_26


App: manual - Page: fragments/expressions_28


App: regression/framework - Page: check/functions_range
PHP
HTML
check/functions_range.pad
Result
{if 10 range (20, 40)   } NOK @else@ ok  {/if}
{if 20 range (20, 40) } ok @else@ NOK {/if}
{if 30 range (20, 40) } ok @else@ NOK {/if}
{if 40 range (20, 40) } ok @else@ NOK {/if}
{if 50 range (20, 40) } NOK @else@ ok {/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_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/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/range_excludes_what_is_outside
PHP
HTML
expressions/range_excludes_what_is_outside.pad
Result
{if 50 range (20, 40)}
in
{/if}


App: regression/framework - Page: expressions/range_includes_both_of_its_ends
PHP
HTML
expressions/range_includes_both_of_its_ends.pad
Result
{if 20 range (20, 40)}a{/if}{if 40 range (20, 40)}b{/if}{if 41 range (20, 40)}c{/if}


App: regression/framework - Page: expressions/range_includes_the_value
PHP
HTML
expressions/range_includes_the_value.pad
Result
{if 30 range (20, 40)}
in
{/if}


App: regression/framework - Page: functions/range_includes_its_ends
PHP
HTML
functions/range_includes_its_ends.pad
Result
{echo 100 | range(0, 100)}


App: regression/framework - Page: functions/range_inside_the_ends_is_true
PHP
HTML
functions/range_inside_the_ends_is_true.pad
Result
{echo 50 | range(0, 100)}


App: regression/framework - Page: functions/range_outside
PHP
HTML
functions/range_outside.pad
Result
{echo 150 | range(0, 100)}


App: regression/framework - Page: sequence/a_percentage_of_chance_or_random_draws_its_fraction_too
PHP
HTML
sequence/a_percentage_of_chance_or_random_draws_its_fraction_too.pad
Result
[{sequence chance='0.5%', to=20000, count}{if $sequence range (40, 180)}one in 200{else}{$sequence}{/if}{/sequence}][{sequence random='0.5%', to=20000, count}{if $sequence range (40, 180)}one in 200{else}{$sequence}{/if}{/sequence}][{sequence chance='0%', to=1000, count}{$sequence}{/sequence}][{sequence chance='100%', to=1000, count}{$sequence}{/sequence}]