Jan Paul, is it 97, or maybe 87 actually, in characters?
What is happening here is about parse order, as the entries tag is processed after PHP-on-input. Thus the long length is the length of your pre-parsed string for setting $channel, which I count as on or about 87.
Here’s a chart on parse order, prepared in fine detail by one of your fellow Dutchmen, who’s known around here as Low. You can use it for your issue by noting that exp:entries is a module tag, from the channel module, so it’s evaluated around the middle of parse order.
Low has also built a very useful add-on called Low Variables, but I think that is not what you need here, as really, it is about Constants.
Here may be a possible form of solution, though: the String add-on, from Ty Wangsness, at eMarketSouth.
—You would use this add-on’s ‘set’ tag to form your needed value, and to hold it for use rather than making a PHP variable.
—quite possibly, you can use the ‘set’ tag in your template within your normal use of the exp:entries block.
—You would place your access to the variable in an EE embed, using the ‘output’ tag.
—You would call the embed at any position you want the result to show, in the top template: even _before_ the value has apparently been set within an exp:entries block.
This works because in the parsing order, an embed is run only after everything in its higher template has been completed—except that its evaluation is inserted into the overall results.
It’s a clever solution, and not expensive.
Hoping this helps your case, and for others who run into this kind of need.
If EE isn’t exactly a conventional programming language, its fit with one is interesting. Here in the solution you’re getting to use a value before it’s been computed—a kind of lazy evaluation, as it’s called.
Regards,
Clive