phpoperatorsdot-operator

how to treat dot as a dot and not as a dot operator in php


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


Solution

  • Try this:

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