SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Pandora Tipem's Avatar
    Join Date
    Feb 2006
    Posts
    450
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript to PHP equivalent?

    Hi,

    I have a simple piece of javascript code here... what would the PHP equivalent of this piece of JS code be? I'm not familiar with charCodeAt()...

    Code javascript:
    if(encodedDigits.charCodeAt(x) == 32)
    where encodedDigits is a string and x is a variable in a for() loop.

    Any ideas? Thanks in advanced.
    Tipem no fancy sig, yup
    Need Neopets Help? Try Neopets
    fun adoptable eggs

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $s 'string';

    for ( 
    $i 0$i strlen$s ); $i++ ) {
        print 
    ord$s$i ] ) . "\n";

    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.



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
  •