PHP variable with multiple strings to an array -


this code in drupal view table template $row = content get..

var_dump($row);  // output: array(5) {      ["field_datum"]=> string(0) ""      ["field_werf"]=> string(9) "comis cui"      ["field_machine"]=> string(17) "graafmachien d293"      ["field_aantal_uren"]=> string(1) "5"      ["view_node"]=> string(50) "bekijk"  }  $uren = $row['field_aantal_uren']; var_dump($uren);  // output: string(1) "5" string(1) "7" string(1) "1" 

i've tried explode, str_replace, preg_replace 3 strings in array can loop on them them , make sum. can't make work..

any suggestions transform variable array?

you var_dumping within loop. try this:

$uren[] = $row['field_aantal_uren']; 

and outside of loop, have array.

echo array_sum($uren); 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -