Hmm, I’ve just done a little test plugin that does this :-
define ('THIS_IS_ONE',1);
$testtext = 'This is a test string';
return;
attached to system event OnParseDocument
I’ve written a little snippet that prints these out in the content of a document, I get this :-
This is one is :- 1
Test text is :-
even if I use global $testtext in the snippet, so the constant stays in scope, the variable doesn’t.
I think you’d be better including your common stuff at the top of your snippet calls with require_once, I think these effects are seen as a combination of how the core does things and the eval() function.