<?php include 'bootstrap.php'; $str = "Hello World"; showCommand("length", '$str = "Hello World"', '$str->length()', $str->length()); showCommand("slice", '$str = "Hello World"', '$str->slice(0,3)', $str->slice(0, 3)); showCommand("split", '$str = "Hello World"', '$str->split(" ")', $str->split(" ")); showCommand("toArray", '$str = "Hello World"', '$str->toArray()', $str->toArray()); showCommand("toJSON", '$str = "Hello World"', '$str->toJSON()', $str->toJSON());
<?php include 'bootstrap.php'; $num = 12; showCommand("add", '$num"', '$num->add(4)', $num->add(4)); $num = 12.5; showCommand("add", '$num', '$num->add(4.2)', $num->add(4.2)); $num = -25; showCommand("add", '$num', '$num->abs()', $num->abs()); $num = 12.5; showCommand("toInt", '$num = 12.5', '$num->toInt()', $num->toInt()); $num = 12.5; showCommand("toJSON", '$num = 12.5', '$num->toJSON()', $num->toJSON());
<?php include 'bootstrap.php'; $arr = [1 => "first", 2 => "second", 3 => "third", 4 => "fourth", 5 => "fifth"]; showCommand("chunk", '$arr = [1=>"first", 2=>"second", 3=>"third", 4=>"fourth", 5=>"fifth"]', '$arr->chunk(2)', $arr->chunk(2)); $arr = [["key1" => "value", "key2" => "value2"], ["key1" => "value", "key2" => "value2"]]; showCommand("column", '$arr = [["key1"=>"value","key2"=>"value2"],["key1"=>"value","key2"=>"value2"]]', '$arr->column("key2")', $arr->column("key2")); $array = ["k1" => "val", "k2" => "val2"]; $array2 = ["k2" => "val2", "k3" => "val3"]; showCommand("diff", '$array, $array2', '$array->diff($array2)', $array->diff($array2)); $array = ["k1" => "val", "k2" => "val2"]; showCommand("hasKey", '$array', '$array->hasKey("k2")', $array->hasKey("k2")); $array = ["k1" => "val", "k2" => "val2"]; showCommand("push", '$array', '$array->push("val3")', $array->push("val3")); $array = ["k1" => "val", "k2" => "val2", "k3" => "val3"]; showCommand("rand", '', '$array->rand()', $array->rand()); $array = ["k1" => "val", "k2" => "val2", "k3" => "val3"]; showCommand("reverse", '', '$array->reverse()', $array->reverse()); $array = ["k1" => "val", "k2" => "val2", "k3" => "val3"]; showCommand("toJSON", '', '$array->toJSON()', $array->toJSON());