Skip to content

Looping through JSON Data

There is probably a simple response to this, but I’ve scoured the net trying to find an answer. Imagine the following JSON data ($json): What I’d like to do is loop through the data contained within Mid3, so that I can display Bottom1, Bottom2, etc.. so I thought this would work: Does anyone know …

php delete a single file in directory

I’ve got the php list directory script from this link http://www.gaijin.at/en/scrphpfilelist.php. How do I delete a single file from the directoy? I tried unlink, but it deleted all the files from that directory. this the short code what i got from the link! the list directory folder call : backup. in t…

PHP Warning: Unknown: failed to open stream

I edited the apache httpd.conf file recently for the mod_rewrite to work. I don’t know if this problem originated from that or not, but i’m getting this problem from that day. This is what I see on the frontend when I run the software – Server error The website encountered an error while ret…

Add missing keys into array

I have an array like this, with missing keys: array(2) { [0]=> string(4) “Bill” [2]=> string(13) “billy@kid.com” } How can I add missing keys to it with empty strings as values? I want …

executing a Powershell script from php

I’m trying to execute a powershell script from PHP, but it does not seem to work. The script ‘newEvent.ps1’ creates an event on the Exchange server. It outputs: If I run powershell.exe C:wampwwwantassetspsnewEvent.ps1 on the command-line, it works fine. This is the first time im attempting s…

in_array for a combo value (‘test’,’value’)

I’m trying to use in_array or something like it for associative or more complex arrays. This is the normal in_array What I’m trying to search is a pair, like the combination ‘test’ and ‘value’. I can set up the combo to be searched to array(‘test’,’value&#…

How to change sql_mode at runtime

My MySQL server’s sql_mode setting is set to STRICT. I want to change it to TRADITIONAL for a particular application I’m developing. However it’s not possible for me to do this at the server level. …

file_get_contents => PHP Fatal error: Allowed memory exhausted

I have no experience when dealing with large files so I am not sure what to do about this. I have attempted to read several large files using file_get_contents ; the task is to clean and munge them using preg_replace(). My code runs fine on small files ; however, the large files (40 MB) trigger an Memory exha…

PHP strtotime() different results of monday this week

I have a problem getting the date of monday in the current week. When I’m running the above code on my local machine (PHP 5.3) it outputs correctly ‘2011-03-07’, but the same code on my server (PHP 5.2) outputs ‘2011-03-14’ (that’s monday next week). I’ve tried to run…