Skip to content

PHP – replace all “n” Occurrences in a string

I am getting a string in my PHP output with lots of n characters which I would like to convert into <p> to get a new line characters in html outpot. I have tried following: Both of these doesn’t seems to work. Any ideas what’s wrong in the syntax? Answer Try this: PHP: Output:

Send value of submit button when form gets posted

I have a list of names and some buttons with product names. When one of the buttons is clicked the information of the list is sent to a PHP script, but I can’t hit the submit button to send its value. How is it done? I boiled my code down to the following: The sending page: The receiving page: buy.php

Gettext not working, what’s wrong?

I’m using gettext for adding different translations into my webpage. I’ve just installed it and I think it works fine. I also use Poedit for the .po files. This is the code I have for my gettext …

output printer ESC codes from twig in Symfony

I have a system that uses Symfony, and is connected to a (citizen ct-s2000) POS printer. What I currently do is render the string to send to the printer, using the twig service: and send this to the printer using fwrite, after that I feed the paper 1 line and cut the paper using: This all works like a charm,

Update data on a page without refreshing

I have a website where I need to update a status. Like for a flight, you are departing, cruise or landed. I want to be able to refresh the status without having my viewers to have and reload the whole …

What is the meaning of double underscore in PHP?

I have a PHP function from the Internet like this: What is the meaning of $___kata and $_kata? Is that the same as $kata on the top of function? Answer They are different variables. They aren’t related in any special way. $foo, $__foo__ and $__foo are all simply different variables like $a, $b, $c.