Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27212

VS 2010 Please help converting 2 PHP functions to vb.net (or c#)

$
0
0
I'm converting a php code containing the following 2 functions:

PHP Code:

     /**
     * Covert a string into longinteger
     *
     * @param string $data
     * @return array
     */
    
function _str2long($data)
    {
        
$n strlen($data);
        
$tmp unpack('N*'$data);
        
$data_long = array();
        
$j 0;

        foreach (
$tmp as $value$data_long[$j++] = $value;
        return 
$data_long;
    }

    
/**
     * Convert a longinteger into a string
     *
     * @param int $l
     * @return string
     */
    
function _long2str($l)
    {
        return 
pack('N'$l);
    } 

I am currently concerned with php pack and unpack functions. Although I've got some rough understanding about what they are doing I am a bit worried if I understand them right and I've no test data to ensure I'll make a correct implementation. Can anyone help me to convert this code or basically, what I want is to get a correctly working implementation of php pack and upack functions with this exact format ("N" and "N*") in either vb.net or c#.

Viewing all articles
Browse latest Browse all 27212

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>