In this case I have an array that is parsed from a JSON file. Normally I use all the elements in the array, but for AJAX crawling I only show the parts the search engine asked for:<?php $fitstyles = json_decode(file_get_contents(DATA_FILE), true); ?><?phpif ($base == fits || $base == gallery) {    /* For fragment handler, delete out the parts of the fits array that aren't needed. */    $keep_fit = $fragments[1];    $keep_style = $fragments[2];    foreach ($fitstyles as $fit => $styles) {        if ($fit != $keep_fit) {            unset($fitstyles[$fit]);            continue;        }        foreach ($styles as $style => $styleinfo) {            if ($style != $keep_style) {                unset($fitstyles[$fit][$style]);                continue;            }        }    }} ?>Here, $fragments looks like:(    [0] => fits    [1] => straight    [2] => utility)and $fitstyles takes the following form:Array(    [straight] => Array        (            [utility] => Array                (  )        )    [anotherfit] => Array        (            [anotherstyle] => (  )        ))The approach appears to work; however, please give me feedback as to the effectiveness, efficiency and readability of this approach.
How should I efficiently delete elements from a PHP array?
php;array
Your code is just fine, exactly how I would do it. There isn't much to discuss really, it's kind of simple. It's as effective / efficient as it could be, and fairly readable. 