PHP Question

I want to print a number string but I’m having trouble.

$Value = ‘1234’;
$Print_Value = $Current_Version[0] . $Current_Version[1] . $Current_Version[2] . $Current_Version[3] ;
echo ("$Print-Value");

I want it to print 1.2.3.4.

I know that $ST=$STR.$STR1 combines strings but I can’t figure how to
get the desired output.

$a = ‘bre’;
$b = ‘athe’;

$out = $a.$b; // $out = breathe
$out = $a . ‘.’ . $b; // $out = bre.athe

You need to also “dot” in the period. Even with that I still don’t fully understand your question… do you want to print the value in $Value, with periods between all the numbers, or are the digits in CurrentVersion?

rock on! Thanks!

<?
$Value = '1234';
$Print_Value = '';
for ($i = 0; $i < strlen($Value); $i++){
  if ($i != (strlen($Value) - 1))
    $Print_Value .= $Value{$i} . '.';
  else
    $Print_Value .= $Value{$i};
}

echo $Print_Value;
?>

I believe is something like that, you are waiting for…
just feedback if don’t…

:slight_smile:

Ok one more :slight_smile:


$Print_Version =  $Current_Version[0].'.'.$Current_Version[1].'.'.$Current_Version[2].'.'.$Current_Version[3]; 
$comment='<font color="red"><b>'.$Print_Version.'</b></font>';


I need the output to be in red 1.2.3.4
It’s sending out 1234 in red

Change the $Current_Version in your second line to $Print_Version and you should be ok, if I’m understanding right.

Thanks for the idea, but, that didn’t fix it. I Just copied it wrong. It’s still printing 1234 instead of 1.2.3.4

wouldn’t this work?

echo "$val[1].$val[2].$val[3].$val[4]";

If you’d like to get fancy:


// I like p instead of font :)
echo "<p style='color: red;'><b>";
foreach($Current_Version as $value) {
     echo "$value.";
}
echo "</b></p>";

There’s probley other simple ways but meh its something to try if your stuck.