I ve built this simple online tool to convert html, css or javascript into php compatible coding string. Not much tricky but just another link for portfolio. Suggessions required from seniors plz.
Location: http://www.movetophp.com
I ve built this simple online tool to convert html, css or javascript into php compatible coding string. Not much tricky but just another link for portfolio. Suggessions required from seniors plz.
Location: http://www.movetophp.com
It does not recognise multiple lines, it writes the lot as one.
Also is echo the only thing it does??
Does this code do anymore than what can be achieved with the heredoc syntax? Not to mention the heredoc syntax doesn't require escaping characters everywhere...
http://uk2.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
I imagine its mostly a learning experience. I'm just curious. Am i not right in thinking it only needs to cancel double quotes?
oh, found a bug. It doesn't cancel out dollar signs.
for example, if you do the following;
<html>
<script>
function $(id){
return document.getElementById(id);
}
</script>
</html>
The Simple way to fix this problem would be to be surround the full thing with single quotes rather than double quotes.
dougal85 wrote:Am i not right in thinking it only needs to cancel double quotes?
Heredoc syntax would also require dollar signs to be escaped.
If I was going to echo a big chunk of arbitrary text it would be as
?>
<html>
<script>
function $(id){
return document.getElementById(id);
}
</script>
</html>
<?php
If I needed to capture that to a variable
ob_start();
?>
<html>
<script>
function $(id){
return document.getElementById(id);
}
</script>
</html>
<?php
$variable = ob_get_clean();
Although in both cases I'd need to properly escape "<?php" if it appears.