I have created a content type in Drupal 8 and I added a field named "body". But I'm unable to use PHP code in this field.
How can I enable PHP in my "body" field?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
Using PHP in your body field is considered bad practice. Read: What are the downsides of using PHP Filter code in blocks, nodes, views-args, etc?
Even in the module page it clearly says:
Enabling this module can cause security and performance issues as it allows users to execute PHP code on your site. There are better alternatives out there that do not expose such vulnerabilities on your site.
The proper way to add your PHP:
Furthermore, Twig has several filters and functions that you can make use of. Which in some cases, you don't even need to use PHP at all.