-1

This is probably an easy solution to this problem, but I am no that familiar with php. When i use this function

function generateXML($array){
    $xmlString = "events: [";
    for ($i = 0; $i < sizeof($array);$i++){
        $obj = $array[$i];
        //print_r($obj);
        $set = "{
            id: \'" + $obj[0] + "\'," +
            print($obj[0] + "");
            "title:\'" + $obj[1] + "\'," +
            "start:\'" + $obj[2] + "\'," +
            "end:\'" + $obj[3] + "\'";
            echo $set + "\r\n";
        $xmlString = $xmlString + $set;
    }
    return $xmlString = $xmlString + "]";
}

a get 233445566778101144 is and I should be getting text not numbers. Any suggestions or clues would be great.

James Mars
  • 21
  • 5

1 Answers1

1

Concatenation operator in php is ., not +. Replace + with ..

+ is an arithmetic operator, an addition. PHP is converting its operands to numbers and the result is also number.

arbogastes
  • 1,308
  • 9
  • 10