Hello I would like to echo the function $ipss instead of "HERE" in my url but I can't do it
<?php $url = "http://api.openweathermap.org/data/2.5/weather?q=HERE&lang=fr&units=metric&appid=b5f11a80423d0d4dae64f1ec1a653edf"; ?>
i tried this but it isn't work
<?php $url = "http://api.openweathermap.org/data/2.5/weather?q=echo $ipss&lang=fr&units=metric&appid=b5f11a80423d0d4dae64f1ec1a653edf"; ?>
CodePudding user response:
You can concatenate a value into a string using the . concatenate operator.
<?php $url = "http://api.openweathermap.org/data/2.5/weather?q=" . $ipss . "&lang=fr&units=metric&appid=b5f11a80423d0d4dae64f1ec1a653edf"; ?>
CodePudding user response:
use {} in double quotes
<?php $url = "http://api.openweathermap.org/data/2.5/weather?q={$ipss}&lang=fr&units=metric&appid=b5f11a80423d0d4dae64f1ec1a653edf"; ?>
