fork download
  1. <?php
  2.  
  3. function recolher($url, $pos=2) {
  4. return array_reverse(explode(".", $url))[$pos];
  5. }
  6.  
  7. echo recolher("+bbbbbbb2.virtua.com.br").PHP_EOL;
  8.  
  9. echo recolher("+000-74-4-000.paemt702.dsl.brasiltelecom.net.br").PHP_EOL;
  10.  
  11. echo recolher("+111.222.22.222.dynamic. adsl.gvt. net.br").PHP_EOL;
  12.  
  13. ?>
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
virtua
brasiltelecom
gvt