Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Need help making this backward compatible until php upgrade

$
0
0

Can some help me make this code backward compatible?

 

 

This code works with php 5.3 and above. I need it to work with 5.2.17.

$columns = 'col1, col2, col3';
$values = '$value1, $value2, $value3';

$result = implode(
', ',
array_map(
function ($c, $v) {
return $c . ' = ' . $v;
},
explode(',', $columns),
explode(',', $values)
)
);

var_dump($result); //this returns: col1 = $value1, col2 = $value2, col3 = $value3

Cheers.

 


Viewing all articles
Browse latest Browse all 13200

Latest Images

Trending Articles



Latest Images