generate functionThu, 24 Nov 2022

remove domain from url , leave only path php

function remove_domain($url) { $disallowed = array('http://', 'https://'); foreach($disallowed as $d) { if(strpos($url, $d) === 0) { return str_replace($d, '', $url); } } return $url; } remove_domain('https://www.google.com/search?q=tutorials+point&oq=tutorials+point&aqs=chrome..69i57j0l5.4835j0j4&sourceid=chrome&ie=UTF-8')

Questions about programming?Chat with your personal AI assistant