3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( "@context" => "http://schema.org", "@type" => "BreadcrumbList", "itemListElement" => array([ "@type" => "ListItem", "position" => 1, "item" =>[ "@id" => "www.example.com/", "name" => "Home" ] //I need $lab[] to show here ]) ); $i = 1; foreach ($pages as $page) { $i++; $arr['itemListElement'][] = [ '@type' => 'ListItem', 'position' => $i, 'item' => [ "@id" => $page->getUri(), "name" =>$page->getLabel() ]]; } var_dump($arr,$lab); json_encode($arr);

preferences:
54.83 ms | 402 KiB | 5 Q