From 11932a471b4ef10faf76b6fcfe30a35f946eb7ab Mon Sep 17 00:00:00 2001 From: Laria Carolin Chabowski Date: Sun, 13 Sep 2020 21:44:30 +0200 Subject: Use short array syntax We can use it now that we switched to PHP 7.3 --- example/index.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'example') 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" => " 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" => " 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"); -- cgit v1.2.3-70-g09d2