• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

str_split values in array

 
Ranch Hand
Posts: 106
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there .

i have this


and i get

Array ( [0] => 0 ) Array ( [0] => 0 ) Array ( [0] => 1 [1] => 0 ) Array ( [0] => 8 ) Array ( [0] => 0 ) Array ( [0] => 0 ) Array ( [0] => 1 [1] => 8 ) Array ( [0] => 8 )

this is what i have on the page .
how can i add the values of every cell.
example
Array ( [0] => 0 ) here i have 1 value but i want [0]=>something and one [1]=something so i want something + something=something;

Array ( [0] => 0 ) the same if its only one value no problem take the value and use it in a variable

Array ( [0] => 1 [1] => 0 ) here i have 2 values one in [0]=>1 and one [1]=0 so i want to have 1+0 =1;

Array ( [0] => 8 )

Array ( [0] => 0 )

Array ( [0] => 0 )

Array ( [0] => 1 [1] => 8 ) here i have 2 values one in [0]=>1 and one [1]=9 so i want to have 1+8 =9;

Array ( [0] => 8 )
after all i want to have them in a variable;

Remember that i have them through print_r ($temp0=str_split($temp2,1)); and this is the only way to have them.


thanks
 
Georgios Chatziefstratiou
Ranch Hand
Posts: 106
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have it .
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Georgios Chatziefstratiou wrote:I have it .


Instead of such a quote, you could post (or explain) your solution. That might help others with a similar problem.
 
Georgios Chatziefstratiou
Ranch Hand
Posts: 106
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Roel De Nijs wrote:

Georgios Chatziefstratiou wrote:I have it .


Instead of such a quote, you could post (or explain) your solution. That might help others with a similar problem.



ok here you have it .I Change a little the code and it works fine. Bye



 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Practically all PHP arrays can be iterated using the list() and each() methods to get the keys and/or values of each element.
 
Georgios Chatziefstratiou
Ranch Hand
Posts: 106
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

K. Tsang wrote:Practically all PHP arrays can be iterated using the list() and each() methods to get the keys and/or values of each element.


ok give an example if you want
 
That which doesn't kill us makes us stronger. I think a piece of pie wouldn't kill me. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic