Skip to content

Tag: 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,

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.

PHP: Undefined index even if it exists

It drives me crazy … I try to parse a csv file and there is a very strange behavior. Here is the csv Now the php code And the output The key “action” exists in $temp but $temp[‘action’] returns Undefined and array_key_exists returns false. I’ve tried with a different key na…

Yii hasAttribute and Custom Fields

How can I use hasAttribute with Custom Fields? Code: EXAMPLE Model.php Code: Answer You should simply use : https://www.php.net/manual/en/function.property-exists.php hasAttribute will only check for db attributes.

Sorting Imap mailbox by date using ImapMailbox.php

I have a customer support system which creates emails when an email is received. I used to postfix and a special configuration to get a hold of the emails to add extra features. For example I want to include attachments that were sent from an email. The system doesnt do this , but creates an email with the su…

GET method in php mvc framework

I am writing a PHP MVC framework from scratch by myself, I use this .htaccess rules to redirect all requests to my bootstrap: Now the problem is I can’t use GET method anymore on forms, when I want to submit a search form using GET method the get parameter won’t send, but it will work with post bu…

laravel compact() and ->with()

I have a piece of code and I’m trying to find out why one variation works and the other doesn’t. return View::make(‘gameworlds.mygame’, compact(‘fixtures’), compact(‘teams’))->with(‘selections’, $…