sudhakarinfotech
(current)
Run Code
PHP Code Editor-
PHP Source Code
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>PHP Function With Argument</title> </head> <body> <h1>PHP Function With Argument</h1> <?php function fruits(&$name) { $name .= ' is one of the best fruit'; echo $name . '<br>'; // outputs "mango is one of the best fruit" } $fruitName = 'mango'; fruits($fruitName); echo 'Outside the function: ' . $fruitName; // it is stil 'mango' ?> </body> </html>
Source Code Output