Last active
May 19, 2017 18:33
-
-
Save azimidev/e1b441f4399db1d006fb95b54943c754 to your computer and use it in GitHub Desktop.
PHP vs JS
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
<?php | |
/* PHP */ /* JavaScript */ | |
mb_strpos($myEmail, '@'); myEmail.indexOf('@'); | |
str_replace('@', '[at]', $myEmail); myEmail.replace('@', '[at]'); | |
mb_substr($myEmail, 0, 5); myEmail.substr(0, 5); | |
mb_strlen($myEmail); myEmail.length; | |
(int) '10'; parseInt('10'); | |
array_key_exists('name', $user); 'name' in user; | |
in_array('Book 1', $userBooks); userBooks.includes('Book 1'); | |
time(); Date.now(); | |
var_dump($varToDebug); console.log(varToDebug); | |
json_encode($user); JSON.strinfigy(user); | |
json_decode('{}'); try { JSON.parse('{}'); } catch (error) {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment