Created
August 7, 2019 21:34
-
-
Save parzibyte/d9c5278715bfed6f731d4f097d74ef5b to your computer and use it in GitHub Desktop.
Convertir binario a decimal con PHP - https://parzibyte.me/blog/2018/10/03/php-intval-y-strval-para-convertir-variables/
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 | |
$binario = "1101"; # El 13 en binario | |
# Con el 2 indicamos que la cadena que le pasamos está en base 2 | |
$decimal = intval($binario, 2); | |
echo $decimal; # Imprime 13 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment