Examveda
Examveda

What will be the output of the following PHP code?
<?php
$author = "nachiketh@example.com";
$author = str_replace("a","@",$author);
echo "Contact the author of this article at $author.";
?>

A. Contact the author of this article at nachiketh@ex@mple.com

B. Cont@ct the @uthor of this @rticle @t n@chiketh@ex@mple.com

C. Contact the author of this article at n@chiketh@ex@mple.com

D. Error

Answer: Option C

Solution(By Examveda Team)

The str_replace() function case sensitively replaces all instances of a string with another.

This Question Belongs to PHP >> Regular Expressions

Join The Discussion

Related Questions on Regular Expressions