Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    making variable that is numeric negative

    i have a function that gets passed an id
    what i want to do is to take the length of that id and then make that length into a negative number. Is there anyway i can do this?
    PHP Code:
      $idlen strlen($id);
      
    $new substr($prefix_new, -$idlen); 

  • #2
    Regular Coder
    Join Date
    May 2006
    Location
    Wales
    Posts
    820
    Thanks
    1
    Thanked 82 Times in 79 Posts
    -$idlen will turn a positive number into a negative number, eg. 10 becomes -10


  •  

    Posting Permissions

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