<?php
function extension1() {
$pathinfo = pathinfo("http://w...content-available-to-author-only...k.com/test.php?somevar"); $query = $pathinfo["extension"];
if (strpos($query,"?") !== false) return $query;
}
function extension2() {
$strs = explode(".", 'http://w...content-available-to-author-only...k.com/test.php?somevar'); $pos = strpos($extension,"?"); if ($pos)
$extension = substr($extension,0,$pos); return $extension;
}
function extension3() {
$baseName = basename('http://w...content-available-to-author-only...k.com/test.php?somevar'); $dotPosition = strpos($baseName,"."); $extension = substr($baseName, $dotPosition+1, strpos($baseName, "?")-$dotPosition-1); return $extension;
}
function extension4() {
$strs = 'http://w...content-available-to-author-only...k.com/test.php?somevar';
return $mathes[1];
}
function extension5() {
$path = parse_url('http://w...content-available-to-author-only...k.com/test.php?somevar'); $extension = substr($path["path"], strpos($path["path"], '.')+1); return $extension;
}
PD9waHAKZnVuY3Rpb24gZXh0ZW5zaW9uMSgpIHsKCSRwYXRoaW5mbyA9IHBhdGhpbmZvKCJodHRwOi8vdy4uLmNvbnRlbnQtYXZhaWxhYmxlLXRvLWF1dGhvci1vbmx5Li4uay5jb20vdGVzdC5waHA/c29tZXZhciIpOyAKCSRxdWVyeSA9ICRwYXRoaW5mb1siZXh0ZW5zaW9uIl07CglpZiAoc3RycG9zKCRxdWVyeSwiPyIpICE9PSBmYWxzZSkgCgkJcmV0dXJuIHN1YnN0cigkcXVlcnksMCxzdHJwb3MoJHF1ZXJ5LCI/IikpOyAKCXJldHVybiAkcXVlcnk7Cn0KZnVuY3Rpb24gZXh0ZW5zaW9uMigpIHsKCSRzdHJzID0gZXhwbG9kZSgiLiIsICdodHRwOi8vdy4uLmNvbnRlbnQtYXZhaWxhYmxlLXRvLWF1dGhvci1vbmx5Li4uay5jb20vdGVzdC5waHA/c29tZXZhcicpOwoJJGV4dGVuc2lvbiA9IGFycmF5X3BvcCgkc3Rycyk7CgkkcG9zID0gc3RycG9zKCRleHRlbnNpb24sIj8iKTsKCWlmICgkcG9zKQoJCSRleHRlbnNpb24gPSBzdWJzdHIoJG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