Should I be able to do something like this:
Code: Select all
<?php
$array = array("h","e","l","l","o");
$i=0;
while($array)
{
$var .= $array[$i];
$i++;
}
print $var;
?>Thanks in advance.
Moderator: General Moderators
Code: Select all
<?php
$array = array("h","e","l","l","o");
$i=0;
while($array)
{
$var .= $array[$i];
$i++;
}
print $var;
?>Code: Select all
<?php
$array=array("H","e","l","l","o");
$otherarray=array();
$usethis=array(TRUE,TRUE,TRUE,TRUE,FALSE);
$i=0; // Do you have to initilise variables? I can never remember
for ($j=0;$j<5;$j++)
{
if ($usethis[j]) $otherarray[i++]=$array[j];
}
$thestring = implode('',$otherarray);
?>part of your questionand I need to combine certain elements of the array to single variables
Reading an uninitialised variable gererates a warning.Gleeb wrote:$i=0; // Do you have to initilise variables? I can never remember
Code: Select all
error_reporting = E_ALLCode: Select all
<?php
ini_alter("error_reporting","E_ALL & ~E_NOTICE");
//put this before reading any variables.
?>