3v4l.org

run code in 300+ PHP versions simultaneously
<?php $nodes = array(); $parents = array() function fillCategory($s, $id, $parentId){ $p = strpos('/', $s); $s1 = substr(0, $p); $s2 = substr($p); if(empty($parentId)){ $parents[$s] = $id; }else{ $parentId = $parents[$s]; } $nodes[] = array($s, $id, $parentId); $id += 1; if(isset($s2)){ fillCategory($s, $id, $parentId); } } fillCategory('Мужчинам / Носки / Белые'); var_dump($nodes);
Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.16, 7.0.0
Parse error: syntax error, unexpected 'function' (T_FUNCTION) in /in/Efdsq on line 5
Process exited with code 255.

preferences:
169.79 ms | 1395 KiB | 24 Q