Pergunta

is there any way to do this in php.i know php treat . as a concatenation operator but i want to force php to treat as a dot when placed between strings

like this

      <?php
    error_reporting(0);
    $ip = gethostbyname(www.($_GET['ip']).com);
<input type="text" id="ip" name="ip"  >

it displays a result

wwwexamplecom

instead i want it like this

www.example.com

i am still a beginner so soory if my question sound too noobish

Foi útil?

Solução

Try this:

<?php
     $ip = gethostbyname('www.'.($_GET['ip']).'.com');
?>

Outras dicas

Try this

 <?php
 $ip = gethostbyname('www'.'.'.($_GET['ip']).'.'com');
 ?>

String concatenation:

$ip = gethostbyname('www.'.($_GET['ip']).'.com');
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top