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
https://forums.phpfreaks.com/topic/159457-int-to-array-is-there-way-to-do-this/
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)

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.