The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Programming Fundamentals" Dec 02 - 2:00 PM Eastern

Php Functions

  • # February 23, 2010 at 12:30 pm

    Hi Everyone

    I need some help, Im trying to echo a function and It doesnt work, is it possible? If so how?


    < ?php echo "http://getUrl()"; ?>

    All it does is shows

    http://getUrl() in the address bar

    Thanks In advance


    # February 23, 2010 at 12:47 pm

    This reply has been reported for inappropriate content.

    Something like this should work.


    Basically you are trying to echo a function call within a string, which is impossible as it is treating the function call like the string.

    I’m not sure if the following also works but you could try

    # February 25, 2010 at 3:49 pm

    Does’nt seem to be working unfortunately. Gota be some how

    $query = “SELECT title FROM go_pages “;

    $result = mysql_query($query);

    while ($row = mysql_fetch_array($result)) {
    echo “

  • $row[title]
  • “;

I want to put the getUrl() function in

# February 25, 2010 at 5:23 pm

Enclose your complex variables in curly braces and you should be fine.

echo “
  • {$row[title]}
  • “;

    # March 12, 2010 at 1:40 am

    This is the exact way to use a echo into the PHP Language,
    $myString = "Hello!";
    echo $myString;
    echo "<h5>I love using PHP!</h5>";

    Viewing 5 posts - 1 through 5 (of 5 total)

    You must be logged in to reply to this topic.

    There's a whole bunch of content on CSS-Tricks.

    Search for Stuff   •   Browse the Archives

    Get the Newsletter ... or get the RSS feed