App: manual - Page: fragments/expressions_32
App: manual - Page: fragments/expressions_33
PHP
|
HTML
fragments/expressions_33.pad
|
Result
|
|
<p>{echo 'well done' | stars}</p> <p>{echo 'well done' | function:stars}</p> <p>{echo 'well done' | upper | stars | php:strlen}</p>
|
|
App: manual - Page: fragments/expressions_6
App: regression/framework - Page: data/data_named_at_its_close_holds_the_values_not_their_stand_ins
PHP
data/data_named_at_its_close_holds_the_values_not_their_stand_ins.php
|
HTML
data/data_named_at_its_close_holds_the_values_not_their_stand_ins.pad
|
Result
|
<?php
// A {data} named on its closing tag parses its walked content, in which a value's // syntax characters travel as stand-ins - a spliced comma splits no CSV cell, a quote // closes no JSON string. The parsed fields kept them: "Smith, John" was stored with the // comma's stand-in, so {if}, where= and php: calls compared and measured another string.
$people = [ [ 'name' => 'Smith, John' ], [ 'name' => 'x=1' ], [ 'name' => 'say "hi"' ] ];
?>
|
{data} name {people}"{!name}" {/people} {/data 'p'}{data}[{people}{notFirst@people},{/notFirst@people}{"n":"{!name}"}{/people}]{/data 'q'}A[{p}{if $name eq 'Smith, John'}eq{else}ne{/if};{/p}]B[{p where='$name eq "x=1"'}{$name}@else@none{/p}]C[{q}{echo php:strlen($n)};{/q}]
|
|
App: regression/framework - Page: expressions/a_long_one_off_expression_is_not_kept_for_the_request
PHP
expressions/a_long_one_off_expression_is_not_kept_for_the_request.php
|
HTML
expressions/a_long_one_off_expression_is_not_kept_for_the_request.pad
|
Result
|
<?php
// Four hundred rows, each splicing a body of 10 KB of its own into an expression: kept for // the request, the texts held some 20 MB after the loop; the 4 MB of the values themselves // stay, kept by padSpliceRecord for the guards of the splice.
$rows = [];
for ( $i = 0; $i < 400; $i++ ) $rows [] = [ 'body' => str_repeat ( 'lorem ipsum ', 850 ) . $i ];
$before = memory_get_usage ();
?>
|
{rows}{echo {$body} | php:strlen | ''}{/rows}[{echo php:memory_get_usage() - $before lt 16000000 ? 'bounded' : 'kept'}]
|
|
App: regression/framework - Page: expressions/a_printf_format_inside_brackets_formats_the_value_piped_into_it
PHP
|
HTML
expressions/a_printf_format_inside_brackets_formats_the_value_piped_into_it.pad
|
Result
|
|
{set $n = 3/}[{echo (1.25 | %.1f)}][{echo php:strlen(1.25 | %.1f)}][{echo php:implode('-', [1 | %02d, 2 | %02d])}][{echo (7 | %'*5d)}][{echo ($n | %.2f | trim) . '!'}][{echo ($n | % 2)}]
|
|
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_value_spliced_into_an_expression_compares_as_its_characters
PHP
expressions/a_value_spliced_into_an_expression_compares_as_its_characters.php
|
HTML
expressions/a_value_spliced_into_an_expression_compares_as_its_characters.pad
|
Result
|
<?php
$q = 'ann@x.com'; $c = 'Paris, TX'; $t = ' {php:getcwd} '; $people = [ [ 'name' => 'Ann', 'email' => 'ann@x.com', 'city' => 'Paris, TX' ], [ 'name' => 'Bob', 'email' => 'bob@x.com', 'city' => 'Rome' ] ];
?>
|
1[{people where='$email eq {$q}'}{$name}{/people}] 2[{people where='$email eq "{$q}"'}{$name}{/people}] 3[{people where='$city eq {$c}'}{$name}{/people}] 4[{if '{$c}' eq 'Paris, TX'}y{else}n{/if}] 5[{if {$c} eq 'Paris, TX'}y{else}n{/if}] 6[{case '{$q}'}{when 'ann@x.com'}hit{else}miss{/case}] 7[{echo php:str_contains('{$c}', ',') ? 'has' : 'no'}] 8[{echo '{$c}' . '' | php:strlen}] 9[{echo '{$c}' | php:strtoupper}] 10[{if '{$c}' . '!' eq 'Paris, TX!'}y{else}n{/if}] 11[{echo php:trim('{$t}')}] 12[{echo php:explode(' ', '{$t}') | php:implode('/', @)}]
|
|
App: regression/framework - Page: prefixes/php_with_a_number
PHP
|
HTML
prefixes/php_with_a_number.pad
|
Result
|
|
{echo php:strlen('abcd')}
|
|
App: regression/framework - Page: tags/chart_heatmap_takes_time_by_its_cells
PHP
tags/chart_heatmap_takes_time_by_its_cells.php
|
HTML
tags/chart_heatmap_takes_time_by_its_cells.pad
|
Result
|
<?php
// A heatmap's time goes by the cells it has, not by every pair of a row and a column: // 20,000 rows of a cell each - each its own row and column - took ten seconds.
$cells = [];
for ( $i = 0; $i < 20000; $i++ ) $cells [] = [ 'r' => "r$i", 'c' => "c$i", 'v' => $i % 7 ];
$start = hrtime ( TRUE );
?>
|
{chart 'heatmap', data='cells', x='c', y='r', value='v' | strlen} {echo hrtime(TRUE) - $start lt 3e9 ? 'in time' : 'too slow'}
|
|
App: regression/framework - Page: tags/chart_sankey_takes_time_by_its_links
PHP
tags/chart_sankey_takes_time_by_its_links.php
|
HTML
tags/chart_sankey_takes_time_by_its_links.pad
|
Result
|
<?php
// The flows into a sankey node are looked up by its name, not searched for in every link // per node: 10,000 nodes and 20,000 links took six seconds.
$flows = [];
for ( $i = 0; $i < 10000; $i++ ) { $flows [] = [ 's' => "a$i", 't' => "b$i", 'v' => 1 ]; $flows [] = [ 's' => "b$i", 't' => 'c' . ( $i % 100 ), 'v' => 1 ]; }
$start = hrtime ( TRUE );
?>
|
{chart 'sankey', data='flows', source='s', target='t', value='v', height=2000 | strlen} {echo hrtime(TRUE) - $start lt 3e9 ? 'in time' : 'too slow'}
|
|
|