diff options
author | Laria Carolin Chabowski <laria@laria.me> | 2020-09-13 21:44:30 +0200 |
---|---|---|
committer | Laria Carolin Chabowski <laria@laria.me> | 2020-09-13 21:44:30 +0200 |
commit | 11932a471b4ef10faf76b6fcfe30a35f946eb7ab (patch) | |
tree | cde92c5eceef8991033fe7773ab60da51e289af4 /example | |
parent | d7d74d0a714f29515da85078cc826ba49d2913b9 (diff) | |
download | ste-11932a471b4ef10faf76b6fcfe30a35f946eb7ab.tar.gz ste-11932a471b4ef10faf76b6fcfe30a35f946eb7ab.tar.bz2 ste-11932a471b4ef10faf76b6fcfe30a35f946eb7ab.zip |
Use short array syntax
We can use it now that we switched to PHP 7.3
Diffstat (limited to 'example')
-rw-r--r-- | example/index.php | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/example/index.php b/example/index.php index caf57eb..0213c34 100644 --- a/example/index.php +++ b/example/index.php @@ -45,22 +45,22 @@ $ste->register_tag( ); # assign some data -$ste->vars["users"] = array( - array("name" => "Foo", "username" => "foo", "online" => true), - array("name" => "Bar", "username" => "bar", "online" => false), - array("name" => "Baz", "username" => "baz", "online" => true) -); +$ste->vars["users"] = [ + ["name" => "Foo", "username" => "foo", "online" => true], + ["name" => "Bar", "username" => "bar", "online" => false], + ["name" => "Baz", "username" => "baz", "online" => true] +]; $ste->vars["title"] = "cool"; -$ste->vars["articles"] = array( - array("author" => "foo", "title" => "cool article", "timestamp" => 1316553353, "excerpt" => "bla", "full" => "blablabla"), - array("author" => "bar", "title" => "awesome", "timestamp" => 1316552000, "excerpt" => "...", "full" => ".........."), - array("author" => "baz", "title" => "<ingenious", "timestamp" => 1316551000, "excerpt" => "...", "full" => ".........."), - array("author" => "baz", "title" => "whatever...", "timestamp" => 1316550000, "excerpt" => "...", "full" => "..........") -); +$ste->vars["articles"] = [ + ["author" => "foo", "title" => "cool article", "timestamp" => 1316553353, "excerpt" => "bla", "full" => "blablabla"], + ["author" => "bar", "title" => "awesome", "timestamp" => 1316552000, "excerpt" => "...", "full" => ".........."], + ["author" => "baz", "title" => "<ingenious", "timestamp" => 1316551000, "excerpt" => "...", "full" => ".........."], + ["author" => "baz", "title" => "whatever...", "timestamp" => 1316550000, "excerpt" => "...", "full" => ".........."] +]; $ste->vars["foo"] = "baz"; $ste->vars["bar"] = "lol"; -$ste->vars["baz"] = array("lol" => "cool"); +$ste->vars["baz"] = ["lol" => "cool"]; # Execute the template and output the result echo $ste->exectemplate("articles.html"); |