PDA

View Full Version : PHP Help



Pixzo
06-10-2008, 07:30 AM
Hey,
I am not sure if this is possible however,
For example if I had a variable set to the number 14

Is it possible for me to change that just to the number 1, so get rid of the second digit?

Thanks

Calon
06-10-2008, 11:36 AM
Don't think that it is possible, I think you can update numbers etc in sessions, if not just use MySQL?

Source
06-10-2008, 12:26 PM
I don't quite get at what you want? You could always just substring it to keep the first number or something, although I'm pretty sure there is another function that will do that.




$varName = 14;
$varName = substr( $varName, 0, 1 );

Calon
06-10-2008, 12:59 PM
I don't quite get at what you want? You could always just substring it to keep the first number or something, although I'm pretty sure there is another function that will do that.




$varName = 14;
$varName = substr( $varName, 0, 1 );


He wants to update a variable

Pixzo
06-10-2008, 02:52 PM
Magic, thats excactly what i was after

Thank you very much

I can't give you Rep atm says i need to spread, i shall rep you when it lets me. Thanks

BuaxDesigns
07-10-2008, 01:41 AM
Although you've already been answered, next time try and go into some detail, I thought you wanted a script which would change all number var's into a single-diget, removing the second digit, not replacing vars.

Want to hide these adverts? Register an account for free!