How can I run PHP code without writing a module? I need to attach a field to some bundles. A PHP snippet will do the job for me, so I don't need a module.The below snippet is what must be executed :

$field_name = 'field_custom_image';
// Create the field.
$field = array(
  'field_name' =&gt; $field_name,
  'type' =&gt; 'image',
);
field_create_field($field);


and then the snippet to add this field to bundle :

// Create the instance.
$instance = array(
  'field_name' =&gt; $field_name,
  'entity_type' =&gt; 'node',
  'bundle' =&gt; 'article',
  'label' =&gt; 'Image',
  'description' =&gt; 'An image for the article.',
  'required' =&gt; TRUE,
);
field_create_instance($instance);


Is there a way to run PHP code directly in Drupal, without the need to write a module, install it, make it run, and uninstall it?
Yes, there is, but given your description I wonder if it will help you:


Install module Devel
Go to http://yoursite/devel/php
Enter your code and execute it.