- print_r: documentation ( source)
- preg_match_all: documentation ( source)
<?php
$tests = [
"hello",
"hello:me",
"hello::me",
"::me",
"hello::hello::me",
];
foreach ($tests as $test) {
preg_match_all('/([^:]+)::(.+)/', $test, $matches);
print_r($matches);
echo PHP_EOL;
}