Last active
April 26, 2017 13:18
-
-
Save viankakrisna/75941b5a7492a2ce80b93301389cb09a to your computer and use it in GitHub Desktop.
php2jsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var string = `copy your php here` | |
console.log( | |
string | |
.replace(/class=/g, 'className=') | |
.replace(/<\?php/g, '{') | |
.replace(/\?>/g, '}') | |
.replace(/echo/g, '') | |
.replace(/{ endif; }/g, '}') | |
.replace(/{ endif;}/g, '}') | |
.replace(/{endif; }/g, '}') | |
.replace(/{endif;}/g, '}') | |
.replace(/{ endif }/g, '}') | |
.replace(/{endif }/g, '}') | |
.replace(/{ endif}/g, '}') | |
.replace(/{endif}/g, '}') | |
.replace(/;/g, '') | |
.replace(/global $/g, 'global.') | |
.replace(/\$/g, 'props.') | |
.replace(/<br>/g, '<br />') | |
.replace(/<hr>/g, '<hr />') | |
.replace(/->/g, '.') | |
.replace(/if\((.*?)\):}/g, '$1 && ') | |
.replace(/if \((.*?)\):}/g, '$1 && ') | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment