Calling Your Function


#1

Hello i don't understand the error help me please
is this
"Oops, try again. Did you remember to call displayName(); in your code? Don't forget the semicolon!"







<?php
// Write your function below!
function displayName($nombre){
echo "el nombre ingresado es"+$nombre;
}
displayName("santiago");

    ?>
  </p>
</body>


#2

Hi, in this line :- echo "el nombre ingresado es"+$nombre;
you have to use '.' instead of '+' for concatenating the string and variable .
'+' is used in javascript not in php
:slight_smile:


#3

already butis not correct is the same error
"Oops, try again. Did you remember to call displayName(); in your code? Don't forget the semicolon!"
but i don't know where put the semicolon :frowning:

<?php
// Write your function below!
function displayName($nombre){
echo "el nombre es " . $nombre;
};
displayName("santiago");

    ?>

#4

yeah, remove the semicolon from second last line before ending tag of php . There is no need to end function with semicolon


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.