How to put php code inside of clientScript?

I want to put a php code inside of Yii::app()->clientScript->registerScript of yii1

How can I put it inside of this one?

<?php Yii::app()->clientScript->registerScript("form", <<<JAVASCRIPT
// I want the PHP code inside of this
JAVASCRIPT, CClientScript::POS_END); ?>

is there a way besides of ending the PHP in the middle of the code?

if I put <?PHP ?> in the middle I’m getting an error of

Parse error: syntax error, unexpected end of file in
on line 275

and that line is

JAVASCRIPT, CClientScript::POS_END); ?>

Nowdoc instead of Heredoc should work

I’m quite confused on what you mean. can you give me example?

I just tried this

    <?php Yii::app()->clientScript->registerScript("form", 
     var a = 2;
     <?PHP echo 'Something' ?>
    , CClientScript::POS_END); ?>

but its not working

I’m receiving this error

Parse error: syntax error, unexpected end of file, expecting variable (T_VARIABLE) or heredoc end (T_END_HEREDOC) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN) in C:\xampp\htdocs\yii\project\protected\views\group\form.php on line 277

Remove php tag, embed php variable.

I think I can’t use those because they can’t handle an array. Anyway the problem is solve by using renderPartial and seperate the script into another php file. thanks for the help.