- preg_match: documentation ( source)
- print_r: documentation ( source)
<?php
preg_match('/(?J)^https:\/\/(?:([^:]*)?(?::(.*))?@)?github.com\/(?<owner>[^\/]+)\/(?:(?:(?<name>.*)\.git)|(?<name>.*))$/', 'https://github.com/toto/titi', $matches);
print_r($matches);