Inserting values inside an array
Lets say I have this variables:
$build_1 = 'bricks, stones and other stuff';
$build_2 = 'more bricks, houses and other th开发者_JS百科ings';
How can I insert the content of $build_1
and $build_2
in a third variable like $build_total
?
After that, I want to insert $build_total
inside a mysql database and get 'bricks, stones and other stuff, more bricks, houses and other things'.
$build_total = $build_1 . ', ' . $build_2;
?
$build_total = $build1 . ", " . $build2;
If $build_1 and $build_2 would be in an array, you could use the implode-method.
<?php
$build = array("bricks, stones and other stuff", "more bricks, stones and other stuff");
$build_total = implode(", ", $build);
?>
精彩评论