note 68361 modified in function.dechex by danbrown

From: Date: Tue, 16 Feb 2010 23:28:25 +0000
Subject: note 68361 modified in function.dechex by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-166041@lists.php.net to get a copy of this message
I leave code blocks them that I have made to be able to replace the content of certain blocks of JS that used eval () I hope serves to them. <?php // Convert hex 2 str // Imput Example: \x68\x6f\x6c\x61\x20\x6d\x75\x6e\x64\x6f $que=( isset( $_POST['hexadecimal'] ) )?$_POST['hexadecimal']:""; $valores=explode( "\\\x", $que ); for ( $i=0; $i<count( $valores ) ; $i++) { echo chr( hexdec( $valores[$i] ) ) ; } // Convert str 2 hex // Imput Example: hola mundo $que=( isset( $_POST['ascii'] ) )?$_POST['ascii']:""; for ( $i=0; $i<strlen( $que ) ; $i++) { echo "\\x".dechex( ord( substr( $que, $i, 1) ) ) ; } ?> --was-- I leave code blocks them that I have made to be able to replace the content of certain blocks of JS that used eval () I hope serves to them. // Convert hex 2 str // Imput Example: \x68\x6f\x6c\x61\x20\x6d\x75\x6e\x64\x6f $que=( isset( $_POST['hexadecimal'] ) )?$_POST['hexadecimal']:""; $valores=explode( "\\\x", $que ); for ( $i=0; $i<count( $valores ) ; $i++) { echo chr( hexdec( $valores[$i] ) ) ; } // Convert str 2 hex // Imput Example: hola mundo $que=( isset( $_POST['ascii'] ) )?$_POST['ascii']:""; for ( $i=0; $i<strlen( $que ) ; $i++) { echo "\\x".dechex( ord( substr( $que, $i, 1) ) ) ; } http://php.net/manual/en/function.dechex.php

« previous php.notes (#166041) next »