Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8569065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:14:56+00:00 2026-06-11T18:14:56+00:00

I want to attach a php function for example: dtlan(text) < into <li> tag

  • 0

I want to attach a php function for example: dtlan(text) < into <li> tag but i have one problem. i will show now my code and output:

echo "<a href=/".$array['id']."><li id='menu_".$array['id']."'>"
     .dtlan($array['name'])."</li></a>";

output must be like this:

<a href='/2'> <li id='2'>wazaap </li></a>

actual output is:

   wazaaap
    <a href='/2'><li id='2'></li></a>

thats meens function runs first. and now my question how i can insert function into tags. thanks all and sorry for my ugly english 😀

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T18:14:57+00:00Added an answer on June 11, 2026 at 6:14 pm

    I think (or I am quite sure) that the function doesn’t return the value, but echoes it instead.

    Because the function is called during the process of building the string to echo. That means, the function has already echoed its value by the time the html is echoed. That’s why the function result is displayed before the html.

    Either make the function return the value instead of echo it:

    function dtlan($x)
    {
      // echo $x;  <- Not like this
      return $x; // But like this.
    }
    

    Or do like this:
    First echo the first part. Then let the function echo its part. Then echo the closing part.

    echo "<a href=/".$array['id']."><li id='menu_".$array['id']."'>";
    dtlan($array['name']);
    echo "</li></a>";
    

    If you have the choice, I would choose the first.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to attach image with attributes for example i have manufacture attribute and
I have a problem with dojox.form.Uploader. I want to use it to attach files
Want to run javascript function from parent window in child window Example I have
I am sending an email through php no problem. I want to attach a
I want to have multiple checkbox values be stored into one field in a
I want to send email with php mail function, where I can also attach
I have an EditText and I want to attach to it a KeyListener that
i have a Button on a HTML page . i want to attach file
I have a form with one text box that is part of a div
Hi I want to send loop data with php mail function here is my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.