tags:

views:

85

answers:

4

Could someone convert this line of code to be readable by HTML?

echo '<h3>'. $r['title'] .'</h3>';

into something like this:

<?php echo...blah blah blah ?>     /* To display the title in HTML  */

I am sure I am not doing it right, that's why it's still not working :(.

Edit: There seems to be a confusion here. I am not going to modify the original php function. What I need to do is call it to my HTML page, to display the Title of the page

+1  A: 
function r($text, $level = 3)
{
    $tag = 'h' . $level . '>';
    return '<' . $tag . $text . '</' . $tag;
}

Thanks for the downvote. The given question is totally unclear and constantly edited.

fabrik
That's not what I am asking at all...
Silence of 2012
What's the problem with that?
fabrik
I've updated my question. Basically I need it rewritten into this form: <? php echo.......
Silence of 2012
This function works just like you want it to in the example you gave. If you want something else you need to add more detail to your question.
Carson Myers
A: 

Save the result into a variable.

<?php $title = '<h3>'. $r['title'] .'</h3>';?>

<?php echo $title; ?>
gearsdigital
A: 

Not exactly sure what you're asking, but you can't use PHP code within an HTML page.

The line

<?php echo '<h3>'. $r['title'] .'</h3>'; ?>

Within a PHP file, will print out the contents of $r['title'], within <h3> tags.

There is no function involved; $r is an associative array variable and title is a key to a particular value.

e100
A: 

Ah you mean?

<php echo "&lt;h3&gt;$r['title']&lt;/h3&gt;"; ?>

could be an answer to this unclear question

Redlab