Activity Stream
48,167 MEMBERS
6989 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16
  1.     
    #11
    (╯?□?)╯︵ ┻━┻
    Website's:
    Xenu.ws WarezLinkers.com SerialSurf.com CracksDirect.com
    He said he wanted to convert a given string to the '\x[0-9a-f]{2}' form (which javascript uses, not PHP), which is what both you and I gave working functions for.

    As mentioned in my previous post, I was merely giving an example of an alternative, more modern way you could do it using PHP 5.3. I never stated it was the best way in terms of portability.

    Every developer knows what language uses the '\x' representation, which is why my assumptions were made. In which case, what I said about needing one occurrence per character remains true. You can also see this from his initial example where he uses it on a per-character basis, implying it is a javascript string or similar.

    Have a good day Lock Down, don't be so defensive in future, remember it was just a response.
    Projects:
    WCDDL - The Professional DDL Script
    Top Secret Project: In Development - ZOMG
    ImgTrack - Never Have Dead Images Again!

  2.   Sponsored Links

  3.     
    #12
    Respected Member
    My bad then as I thought he mentioned php.
    So I think you should give him the exact code needed to convert it with javascript.

  4.     
    #13
    (╯?□?)╯︵ ┻━┻
    Website's:
    Xenu.ws WarezLinkers.com SerialSurf.com CracksDirect.com
    It seems like he wanted a PHP solution to the problem, just the string he's trying to convert to appears to be a javascript string.

    What does it matter though, he has the answer now, twice lol.
    Projects:
    WCDDL - The Professional DDL Script
    Top Secret Project: In Development - ZOMG
    ImgTrack - Never Have Dead Images Again!

  5.     
    #14
    Respected Member
    Where was the twice.

    Your function with no reference to the rest of the code posted was not an answer and you should really finish what you start.

    Let's see the the javascript answer to the question. I am sure he could use it as other members.

    Shouldn't take you but a few minutes for a working tested solution.

  6.     
    #15
    (╯?□?)╯︵ ┻━┻
    Website's:
    Xenu.ws WarezLinkers.com SerialSurf.com CracksDirect.com
    I didn't feel the need to reference the rest of the code as you had already posted it previously, this was simply a potential replacement for the function in that code. Since there was only one function in use, it seemed obvious to me that would be the one to replace. I did finish, thanks to the rest of the code already existing due to your post.

    As for the javascript, he asked for it in PHP, not JS. But for your satisfaction:
    Code: 
    var str = 'some string';
    str = str.replace(/./g, function(c) { return '\\x' + c.charCodeAt(0).toString(16); });
    // str now contains the characters using '\x' notation
    However, it won't evaluate the characters. This is due to the '\\x' being evaluated first in the return statement, then the character code (in hex) separately. Meaning the string will literally contain the '\x' notation.

    Doing something like the following would result in the '\x' codes being evaluated, leading to the initial string.
    Code: 
    str = str.replace(/./g, function(c) { eval("c = '\\x" + c.charCodeAt(0).toString(16) + "';"); return c; });
    As for it being tested, there's no need, I know it works from reading the code.
    Projects:
    WCDDL - The Professional DDL Script
    Top Secret Project: In Development - ZOMG
    ImgTrack - Never Have Dead Images Again!

  7.     
    #16
    Respected Member

Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to Encode Like this..??
    By downloadsmasti in forum Tutorials and Guides
    Replies: 21
    Last Post: 10th Nov 2012, 10:20 PM
  2. Encode to html
    By skinner in forum Web Development Area
    Replies: 4
    Last Post: 21st Feb 2012, 02:28 PM
  3. Need RDP to encode
    By TheLorenalex in forum Hosting Discussion
    Replies: 9
    Last Post: 25th Nov 2011, 06:08 PM
  4. how to encode a movie
    By chaudhary9 in forum General Discussion
    Replies: 2
    Last Post: 24th Sep 2011, 11:27 PM
  5. Need VPS for encode
    By chipve in forum Hosting Discussion
    Replies: 4
    Last Post: 2nd Feb 2011, 03:26 PM

Tags for this Thread

BE SOCIAL