Lesson 6 Pl help to fix the syntax Error


#1

Below is my code.

 <?php
   greetings($name){

echo "greetings, " . $name . "!" ;

greetings("rajesh");

}`

?>

#2

<?php

function greetings($name){ //function declaration

echo "greetings, " . $name . "!" ;

}`

greetings("rajesh"); //calling the function should be outside the function declaration


?>

hope that helps :slight_smile:

Also when using double quotes you need not concatenate using the period (.)... this works too

echo "greetings,  $name  !" ;

#3

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