Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

95
Vistas
PHP Decimal to base64 give different result with javascript

can someone tell me why fo base64 result give different result for PHP

with Javascript that's give right result

decimal 68 98 7 will show RGIH https://v2.cryptii.com/decimal/base64 javascript decimal to base64

why on php i not see same result

with this code

$x = floatval('68 98 7'); echo base64_encode($x);

will show Njg=

Thanks

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This is because the website you've posted doesn't interpret the decimals as decimals, but as the decimal values for their ASCII counterparts. If you want to perform the same operation in PHP, you could first transform the decimal string to an array by exploding on the spaces, applying chr to each entry of the array, and then base64 encoding the imploded array:

$decimals = '68 98 7';
$chars = array_map(fn($decimal) => chr((int)$decimal), explode(' ',$decimals));
echo base64_encode(implode('', $chars));
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda