Something that you may need to do one day or another is validating a custom form field value as if it was a Content field existing value, outside of the node form context.

There is something quite sad about Content module, that is the API does not seems (in Drupal 6, at least, I'm awaiting for a lot of improvements in D7 Field API) to expose any function for manual field validation. The whole process of validation goes through the numerous iterations in node_form and in hook_nodeapi() content module's implementation.

I found a way, quite ugly, but tested and working, let's analyse the following code (comments are inside the function)...

This is often a problem when you pragmatically manipulate views row's : finding the primary key value of the current row being explored.
Let's have an example : A node base table based view.

<?php// Load the view, and stick to default display for sample purpose.$view = views_get_view('my_node_view');$view->set_display(NULL);// Then, execute it.$view->pre_execute();// You will set some other options here, like limit, pager, offset.$view->execute();?>

Sometimes, when you are trying to debug PHP code, you'll get an ugly WSOD, without any error messages in PHP error log.

When this happens, it's always really difficult to find out why. The lack of message tells you that you you didn't wrote something that bad, but bad enougth for the framework you are working with to partially catch your error without really crashing.

If you answered NULL, 0 or '7rray', you're absolutely wrong. The magic with PHP is whatever you use (int) or intval() you get absolutely weird results, because it'll try to parse your string as an integer whatever is in it.