So I understand, you have defined the $cidade
variable on the PHP page and want to reference it directly (using PHP code) in the clima.js
file.
If this is the case it will not work because the <script src="clima.js"></script>
block is interpreted by the browser (client) and not by the server (which is the case of PHP codes).
What you can do to get around this is in the PHP page insert such a code:
<script src="clima.js"></script>
<?php
// este elemento HTML faz a separação entre os códigos server e client side
?>
<input type="hidden" value="<?php echo $cidade;?>" id='idCidade'/>
<script>
// obtenção do parâmetro cidade
var idCidade = window.document.getElementById ('idCidade').value;
// função do arquivo clima.js
var result=getClima(idCidade);
alert(result);
</script>
It is good practice to separate the server side and client side codes (in your case, PHP and Javascript respectively). The more separated, the better for maintenance and understanding.