Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,203 members, 7,953,747 topics. Date: Friday, 20 September 2024 at 02:58 AM |
Nairaland Forum / Science/Technology / Programming / How Can I Add List Of Words From An API (1068 Views)
How To Retrieve Data From An Api Using Fetch Api In Javascript / Help With Calling An API / I Need A Programmer To Design An API Scripts Library. (2) (3) (4)
How Can I Add List Of Words From An API by Nobody: 4:06pm On Feb 05, 2017 |
Good day programmers. I was working on a script lately php precisely. I'm working with an api. so I pulled out some numbers from the api. now I want to add them together how do I do that... example.. api gave strings as 428262848027. now I wan the machine to add 4+2+8+2+6+2+8.... note I tried to convert them to an array but they all have 0 as index numbers. pls help me |
Re: How Can I Add List Of Words From An API by Nobody: 4:47pm On Feb 05, 2017 |
seunoni34:can u help me here pls |
Re: How Can I Add List Of Words From An API by seunoni34(m): 4:48pm On Feb 05, 2017 |
lankykid:I didn't even know this was another post. Brb |
Re: How Can I Add List Of Words From An API by FrankLampard: 5:37pm On Feb 05, 2017 |
Re: How Can I Add List Of Words From An API by seunoni34(m): 7:30pm On Feb 05, 2017 |
lankykid:Assuming $string is the variable you want to split $array = str_split($string); // this splits each character in $string to an array /* i.e if $string = 1234. The $array will look like Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 ) */ $sum = 0; // initialize variable that sums up all the numbers // sum up the array of splitted numbers while looping foreach($array as $num) : $sum+=$num; // adds up all the numbers endforeach; echo $sum; |
Re: How Can I Add List Of Words From An API by Nobody: 4:55pm On Feb 06, 2017 |
FrankLampard:tanx a lot bro... |
Re: How Can I Add List Of Words From An API by Nobody: 4:56pm On Feb 06, 2017 |
seunoni34: Thanks a lot bro, this helped |
(1) (Reply)
Visual Basic Help Please / Where Can I Download Free Fortran Compiler / Top 10 Best Programming Apps For Android (latest)
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 12 |