Created
September 18, 2014 09:07
-
-
Save Ultrabenosaurus/8154ba317dfe023ea1cd to your computer and use it in GitHub Desktop.
basic logging of PHP values in Dev Tools console
This file contains 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
<snippet> | |
<content><![CDATA[ | |
echo "<script type='text/javascript'>if( window.console && console.log ){ var thing = " . json_encode( ${1:thing} ) . "; try{ console.log( JSON.parse(thing) ); }catch(e){ console.log( thing ); } }</script>"; | |
]]></content> | |
<!-- Optional: Set a tabTrigger to define how to trigger the snippet --> | |
<tabTrigger>clog</tabTrigger> | |
<!-- Optional: Set a scope to limit where the snippet will trigger --> | |
<scope>source.php</scope> | |
</snippet> | |
<!-- | |
clog = console.log | |
basic logging of PHP values in Dev Tools console! | |
<script type='text/javascript'> | |
if( window.console && console.log ){ | |
var thing = " . json_encode( ${1:thing} ) . "; | |
try{ | |
console.log( JSON.parse(thing) ); | |
} catch(e) { | |
console.log( thing ); | |
} | |
} | |
</script> | |
--> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment