3v4l.org

run code in 300+ PHP versions simultaneously
<?php $paragraphs = []; // create an empty array we will put our two paragraphs into // define your two paragraphs/text-items with everything that's unique to them: $paragraph = new stdClass(); // just creates a simple object we can fill with infos $paragraph->elementId = "dyn_Loop_main_v1"; // the id of the related html element $paragraph->updateTime = 1500; // how quick it should switch to next text in ms $paragraph->content = array("TEXT for ID_1_1", "TEXT for ID_1_2", "TEXT for ID_1_3", "TEXT for ID_1_4"); $paragraph->default = "Default Text 1"; $paragraph->counter = 0; $paragraphs[] = $paragraph; // add this paragraph to the array // same for the second paragraph: $paragraph = new stdClass(); $paragraph->elementId = "dyn_Loop_main_v2"; $paragraph->updateTime = 1000; $paragraph->content = array("TEXT for ID_2_1", "TEXT for ID_2_2", "TEXT for ID_2_3", "TEXT for ID_2_4"); $paragraph->default = "Default Text 2"; $paragraph->counter = 0; $paragraphs[] = $paragraph; // add this paragraph to the array echo json_encode($paragraphs, JSON_PRETTY_PRINT);

preferences:
25.84 ms | 404 KiB | 5 Q