The drop is always movingYou know that saying about standing on the shoulders of giants? Drupal is standing on a huge pile of midgetsAll content management systems suck, Drupal just happens to suck less.Popular open source software is more secure than unpopular open source software, because insecure software becomes unpopular fast. [That doesn't happen for proprietary software.]Drupal makes sandwiches happen.There is a module for that

Down with pseudo objects

Submitted by nk on Sun, 2007-07-22 20:00

Note: this is a reformatted repost of the original, I have my moved my blog and that entry was not in the dump. It needed a reformat anyways...

I had a node which stored user profile data and upon blocking said user I wanted to clean it up. A little bit later I will post the code -- for now let it suffice that I needed to use $profile->{$key}[0][$k] = ''; instead of $profile[$key][0][$k] = ''; . I consider myself a not-too bad PHP coder but this syntax took me quite some time to figure out.

I will remove all pseudo objects in Drupal 7, this is a farce and causes severe pain. Also with the onset of PHP5, object passing is always a reference which will be fun. No more. Arrays are arrays, period.

To sum up user comments, some (demeester_roel and Crell) were defending the objects on the grounds that PHP5 can do better with objects -- we shall see. Adrian, Moshe and Ajk on the other hand are with me and Ajk even offered help in this regard.

Here is the code in all it's g(l)ory:

foreach (array_diff_key((array)$profile, array('type' => 1, 'uid' => 1, 'nid' => 1, 'vid' => 1)) as $key => $value) {
  if (substr($key, 0, 6) == 'field_' && is_array($value)) {
    foreach ($value[0] as $k => $v) {
      $profile->{$key}[0][$k] = '';
  else {
    $profile->$key = '';

Commenting on this Story is closed.

Submitted by airarmy on Tue, 2009-10-06 11:58.

The blog is really informative and i like to share it with my friends we can easily learn more about web designing through this post thanks for post In 1950 Tiffany's had its biggest boost in popularity as Truman Capote's Breakfast at Tiffany's was published. Tiffany's was shot to worldwide fame in 1961 when the film adaptation staring Audrey Hepburn was released. This film and its star became icons
Tiffany jewellery
Of course tiffany, the ladies' favorite. Want to see her smile? It is absolutely right to buy
Tiffany co for her. Exquisite tiffany jewelries in high quliat
, bracelet jewelry, tiffany jewelry, necklace jewelry, ring jewelry, finger ring jewelry, earring jewelry.
Tiffany Jewellery offering bangle jewelry, bracelet jewelry, eardrop jewelry, necklace jewelry, ring jewelry, finger ring jewelry and earring jewelry
Tiffany Necklaces
Tiffany Bracelets
Tiffany Rings
links of london