Using PHP, can I put variables inside of variables?

Posted by Rob on Stack Overflow See other posts from Stack Overflow or by Rob
Published on 2010-04-24T03:53:08Z Indexed on 2010/04/24 4:03 UTC
Read the original article Hit count: 273

Filed under:

For example, take this code:

$ch = curl_init($resultSet['url']."?get0=get0&get1=".$get1."&get2=".$get2."&get3=".$get3);

This of course, looks very ugly, and kind of a pain in the ass to read. So my question is, would I be able to use something like this:

$allgets ="?act=phptools&host=".$host."&time=".$duration."&port=".$port;
$ch = curl_init($resultSet['url'] . $allgets);

Very simple question I suppose, but my server is undergoing maintenance, so I can't upload it and test it myself. I suppose a yes or no answer will suffice, but if you have a more efficient way of doing this, that would be even better. :)

© Stack Overflow or respective owner

Related posts about php