Dustin013 Posted June 4, 2008 Share Posted June 4, 2008 $url = $match1; it needs to be something like this... $url = http://$match1; I need to add http:// to the variable... What is the correct syntax? Link to comment https://forums.phpfreaks.com/topic/108619-need-help-with-simple-syntax/ Share on other sites More sharing options...
Lodius2000 Posted June 4, 2008 Share Posted June 4, 2008 try $url = "http://$match1"; that will put http:// at the begining of the sting contained in $match1 Link to comment https://forums.phpfreaks.com/topic/108619-need-help-with-simple-syntax/#findComment-557069 Share on other sites More sharing options...
Dustin013 Posted June 4, 2008 Author Share Posted June 4, 2008 Awesome thanks! Worked like a charm :-) Link to comment https://forums.phpfreaks.com/topic/108619-need-help-with-simple-syntax/#findComment-557071 Share on other sites More sharing options...
Wolphie Posted June 4, 2008 Share Posted June 4, 2008 Although inline variables can be used in PHP, I prefer to avoid them. I do the following. I feel that appropriate code indentation, spacing and use of structure makes reading, modifying and writing new code much easier to follow than code that is all bundled together. <?php $url = 'http://' . $match1; ?> Please remember to hit "Topic Solved" Link to comment https://forums.phpfreaks.com/topic/108619-need-help-with-simple-syntax/#findComment-557074 Share on other sites More sharing options...
whizard Posted June 4, 2008 Share Posted June 4, 2008 I agree with you about variable concatenation. Link to comment https://forums.phpfreaks.com/topic/108619-need-help-with-simple-syntax/#findComment-557076 Share on other sites More sharing options...
Wolphie Posted June 4, 2008 Share Posted June 4, 2008 Well, it's not only that but it saves a lot of time in the future. Granted, it may take a little bit more effort to use that style, and may take time to adjust but it saves far more time when it comes to modifying it. Link to comment https://forums.phpfreaks.com/topic/108619-need-help-with-simple-syntax/#findComment-557077 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.