PHP not highlighting syntax
See original GitHub issueI am trying to get php code to highlight on my webpage, but the code is not being syntactically highlighted. Below is my entire react app:
import React from 'react'
import ReactDOM from 'react-dom'
import Syntax from 'react-syntax-highlighter/prism'
const phpCode = `
$data = array(
'name' => 'James Brown',
'email' => 'jbrown45@example.com',
'phone' => '224-555-6798'
);
$data_string = json_encode($data);
$req = curl_init('/users');
curl_setopt($req, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($req, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string))
);
$res = curl_exec($req);
print($res);
`
ReactDOM.render(<Syntax language="php">{phpCode}</Syntax>, document.getElementById('root'))
That does not highlight the php code.
I’m using:
- React 16.2.0
- react-syntax-highlighter 7.0.2
Thanks
Issue Analytics
- State:
- Created 5 years ago
- Comments:9
Top Results From Across the Web
highlight_string - Manual - PHP
Outputs or returns html markup for a syntax highlighted version of the given PHP code using the colors defined in the built-in syntax...
Read more >Syntax highlighting doesn't work after adding a file ... - YouTrack
The file is created, but PhpStorm doesn't seem to register it as a PHP file and there is no syntax highlighting - it...
Read more >PhpStorm not highlighting PHP code inside a .php file when ...
I am having a problem in PHPStorm where it won't highlight PHP code (but will intellisense it) inside a .php file when it's...
Read more >PHP syntax highlighting not working properly #162 - GitHub
The syntax highlighting for PHP only works when there's an opening tag.
Read more >Sublime Text 3 Bug | Solution & Avoidance Of Not Highlighting ...
Sublime Text 3 Bug | Solution & Avoidance Of Not Highlighting PHP Syntax.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Sorry I’ve been busy with finals. Thanks for this fix!
fixed in
v7.0.4
@wraytw , thanks @wooorm !