Jump to content

INT to array? Is there way to do this?


Paldo

Recommended Posts

Hi !

I want to ask you If its possible to transfer int to array somehow so I can work with seperate digits from this integer.

I was thinking if there is some conversion Int to string, first couse I recall some command like this from other programing language and maybe it could be first step to do maybe, maybe not.

 

What I need is a way to analyze digit, for example 136245  I want to know how many tousants are there how many hundrets and so on...

This is the reason why I'm thinking about putting this numbers  into array.

 

I hope I made my selfe clear somehow.  :)

 

 

Link to comment
Share on other sites

If you're talking about casts

$num = (int)'1221';

 

Would put the int in $num.. though most of the time php handles these kinds of things somewhat transparently as it doesn't support strong typing like most other languages.

For example in java there is.

int anInt = 0;

While in php it's

$int = 0; (notice the lack of data type)

Link to comment
Share on other sites

Have a look at this post

http://www.phpfreaks.com/forums/index.php/topic,252307.msg1185070.html#msg1185070

 

Seems similar to what you're trying to do.

 

Could you be more specific please?

Becouse What I originaly need to do is to transfer either string entred number or int into verbal form, for example 1874 ----> one thousand eight hundreat  seventy four, and I have a strange feeling that there is som easy way to do that, however I'm  not very good with maths.

 

thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.