logo CodeStepByStep logo

name_diamond

Language/Type: PHP string parameters

Write a function named name_diamond that accepts a string as a parameter and prints it in a "diamond" format as shown below. For example, the call of name_diamond("MARTY"); should print:

M
MA
MAR
MART
MARTY
 ARTY
  RTY
   TY
    Y
Function: Write a PHP function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.