Skip to content

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…

Remove folder name from URL

I have a domain www.domain.com redirected to / in my server. Next I have index.php whith code: header(“Location: http://domain.com/v3/”); When I enter mydomain.com I have mydomain.com/v3/ in url. …

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’, $…