I would like to add a php code into a shortcode code in HTML editor.
My shortcode looks like this:
<?php echo do_shortcode('[eapi keyword="KEYWORD" n=25]'); ?>
<?php the_title(); ?>
<?php echo do_shortcode('[eapi keyword="<?php the_title(); ?>
" n=25]'); ?>
Here is a possible solution but I am not familiar with the plugin/context you are using this in. But maybe this will give you some ideas:
<?php echo do_shortcode("[eapi keyword=\"" . the_title() . "\" n=25]"); ?>
So I removed the inner php tags for one. I switched the outer quotes to double quotes since you can't use functions/variables within single quotes. At the same time I concatenated the title function since I don't think it can be interpreted within the quotes. That also might negate the need for double quotes, but force of habit.
EDIT - Some other use examples outside of the original question for clarity.
Variable in the string requires double quotes:
<?php echo do_shortcode("[eapi keyword='{$variable}' n=25]"); ?>
Variable concatenated can use single or double quotes:
<?php echo do_shortcode("[eapi keyword='" . {$variable} . "' n=25]"); ?>
Keywords and functions must be concatenated:
<?php echo do_shortcode("[".KEYWORD." keyword='".func()."' n=25 x={$var}]"); ?>