Search Array Keys and Return Matches

By , Wednesday 13th August 2008 4:26 pm

I’ve had the need to search through an array and return the elements that have keys that match a search term. So I thought I’d share.

‘Why would I need this?’ would probably be the first question you’d ask, well if I wanted to search through an array for all the elements that related to the dimensions of an item then I could pull out the appropriate keys by using this little function:

function searchArrayKey($array,$search) 
 $search = strtolower($search); 
 if (is_array($array)) 
  foreach ($array as $key => $data) 
   if (strpos(strtolower($key),$search) === 0) { $returnArray[$key] = $data; } 
  return $returnArray;
 } else 
 { // User hasn't subimitted an array...
  return false; 

So for example if I wanted to search an array of item data for the dimension data then I could do the following (and print to screen presumably):

$dimensions = searchArrayKeys($itemArray,'dimension');

Which would return something like:

    [dimension_height] => 20
    [dimension_width] => 30
    [dimension_depth] => 40

Custom php.ini with Plesk

By , Wednesday 13th August 2008 3:53 pm

We have a dedicated server with ukFast on which we run a number of domains that exist on virtual servers running under Plesk. Anyway, on most of my domains I want to hide away warnings and for security keep errors to the log files, however on some of my domains (such as those I’m developing on) I want to show every little nasty warning and error that appears.

If I edit my PHP.INI”>php.ini this affects each and every domain on the server, not a good idea especially when several of the sites are fully live versions  So in order to get around this you need to put a file called vhosts.conf in your conf directory, for example, /var/www/vhosts/<my_domain>/conf/vhost.conf.

Once you’ve added your additional code, again for example I included,

php_value error_reporting E_ALL
php_value display_errors On

followed by running the following command (this reconfigures all of your domains its just quicker lazier than typing in the domain name ,

# /usr/local/psa/admin/bin/websrvmng -a

If you’re feeling a bit nimble then you can always type out the full version which is,

# /usr/local/psa/admin/sbin/websrvmng -u --vhost-name=<my_domain>

After this command if you look to httpd.include file, will see that your httpd.include will have an include line for your vhost.conf, something like this:

Include /srv/www/vhosts/


Diving Rheola Lakes, Glynneath

By , Saturday 2nd August 2008 9:00 am

Rheola-004Hearing about a new dive site through YD, it being cheaper (£5) and closer (well for Simon) than the NDAC we decided to head down to check it out. The site is north of Neath on the A465 and is an easy drive from the M4. The site is run by Steve of Quest Marine (site details on link).

Rheola-008There are two lakes at the site, one for powerboating and one for quieter activities (such as diving!).  Parking is right up against the water and for the entire day we were the only two divers there . The smaller lake isn’t huge but an ok size for a smaller number of divers. There’s toilets at the site but not much else, although there’s a burger van a short drive back to the entrance to the site and a place you can buy junk food just around the corner.

Rheola-007The lakes were created as they were dug out for rock to build the heads of the valleys road and have naturally filled up over time, due to that there’s no fish life although plenty of plants. Adding some fish would be quite nice and would draw in some additional money from fishermen, although there were some kids fishing the bigger lake so I guess that there’s probably some in there.

The water was very clear with a good 5-6m visibility, although if you knocked the bottom lots of suspended matter was sent upwards and took a while to settle. The suspended matter was much preferrable to the black dust knocked up if you find a patch without plants. I did this to test what it was like but forgot to take some video to demonstrate

Rheola-011 Rheola-006 Rheola-009

We were told that the max depth was 12m with the lake sloping down in 2m steps but we reached a max of 10.8metres. After about 20 minutes (+ 1 golf ball) we both got a bit bored of the site but pushed the dive to 40 minutes. The second dive we went in with a plan and did several run times with stops at 9m, 6m, and 3m both up and down.

In summary, a good cheap site at £5, not much depth but good for practice. I wouldn’t go for a pleasure dive, there needs to be a purpose, maybe if the site develops a few objects would go in but I don’t know what the owners plans are there!

Diving Rheola Lakes, Glynneath – 2nd August 2008

Panorama Theme by Themocracy

2 visitors online now
0 guests, 2 bots, 0 members
Max visitors today: 13 at 06:05 am UTC
This month: 16 at 18-07-2017 05:35 pm UTC
This year: 45 at 02-01-2017 10:28 pm UTC
All time: 130 at 28-03-2011 10:40 pm UTC