PHP Echo into nodeDataArray

I don’t know, this is more a PHP/general JavaScript question than a GoJS question.

It might be that you are using double quotes in both places. Try changing the expression to single quotes:

'<?php echo $allnodes2 ?>';