I think I see what you're doing...something like this?
$ipcode; // this is the variable with the PHP code...
print $ipcode; // or echo, or something...
You're problem is that you can't do this:
print "<?php print 'HELLO!'; ?>";
You can only print/echo HTML code to a page; PHP only processes output once, not recursively. If the PHP code wasn't there when PHP started processing, it won't be processed as PHP code.
What you want is what LordShryku said: eval(). The eval() function evaluates whatever you give it as php code. For example, this would print the above example correctly:
$ipcode = "print '199.162.105.215';";
eval($ipcode);
Note that if $ipcode were "<?php print '199.162.105.215'; ?>", it wouldn't work; you can't have PHP tags in it.
Note: that's not my real IP; I made it up.
HTH,
Nick