Skip to content
Advertisement

Tag: echo

php for loop from array stops after 3 loops

I have an array that looks like this. I want to loop through array in the first key of [2] and echo all the values. this works, but stops after three loops and the output looks like this: I am expecting — hoping for this: I don’t understand why it is stopping. thanks. Answer Your problem lies here: You are

PHP if statements inside of echo to create HTML option list

I have a HTML option list of 10 numbers. I want one of these options to be pre-selected based on a value retrieved from a database. If the retrieved value is 0 or FALSE then value=”0″ should be selected, if the retrieved value is 1 then value=”1″ should be selected, etc. I have looked at: if block inside echo statement?

get return from echo

I’m working with some functions that echo output. But I need their return so I can use them in PHP. This works (seemingly without a hitch) but I wonder, is there a better way? Example: Answer no, the only way i can think of to “catch” echo-statements it to use output-buffering like you already do. i’m using a very similar

How to echo in PHP, HTML tags

I went through this before posting: How can I echo HTML in PHP? And I still couldn’t make it work. I’m trying to echo this: But I still can’t find a way to make the tags “” and ” disappear. What do I have to do? Answer Just put it in single quotes.

Advertisement