SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    chown linux:users\ /world Hartmann's Avatar
    Join Date
    Aug 2000
    Location
    Houston, TX, USA
    Posts
    6,455
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)

    Simple error driving me nuts!

    I have the following function:

    PHP Code:
    function hex2bin($hexdata) { 
     
    $bindata "";
     
     for (
    $i=0;$i<strlen($hexdata);$i+=2) { 
     
    $bindata.=chr(hexdec(substr($hexdata,$i,2))); 
     } 

    return 
    $bindata

    I am continually getting a UNEXPECTED T_VARIABLE error on line 9 which is
    PHP Code:
    $bindata ""

  2. #2
    SitePoint Addict Quaint's Avatar
    Join Date
    May 2004
    Location
    Netherlands
    Posts
    219
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The code works for me, which means that you didn't close something ABOVE this piece of code. Look for opened brackets, accolades, quotes etc and you should find your problem-causer!

    Quaint Tech
    - Blog on web development and web technology.

  3. #3
    Non-Member bronze trophy geniusgoalie's Avatar
    Join Date
    Sep 2004
    Location
    Buffalo, USA
    Posts
    979
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Quaint
    The code works for me, which means that you didn't close something ABOVE this piece of code. Look for opened brackets, accolades, quotes etc and you should find your problem-causer!
    or maybe he has an outdated version of php. It worked fine for me too though.

  4. #4
    SitePoint Addict Quaint's Avatar
    Join Date
    May 2004
    Location
    Netherlands
    Posts
    219
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by geniusgoalie
    or maybe he has an outdated version of php. It worked fine for me too though.
    That would give a different error.

    Quaint Tech
    - Blog on web development and web technology.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •