Hello tan
The PHP code field can contain any custom PHP code that you want to execute before the content of your article is saved to the database after the user has clicked the Submit button.
So it can be used to do anything possible at that point in time, but of most use would be to either get or set a value.
This is a simplistic example but you could do the following. Let's suppose you had two fields that the user submitted called firstname and lastname, but you also have another field called fullname which the user does not submit. In this example you could do this:
$ARRAY['fullname']->value =
$ARRAY['firstname']->value . ' ' . $ARRAY['lastname']->value;
So if the user entered firstname as 'John' and the lastname as 'Smith', your field fullname would then contain 'John Smith'.
As I say this is a simple example which you probably wouldn't use in practice but hopefully it gives you an idea of how to use it.
In summary, to access the values of fields in the content type you must use the format:
$ARRAY['your_fieldname']->value where 'your_fieldname' is the name of a field from your content type.
Peter