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.
Joel_J
January 25, 2007, 4:26pm
#2
$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?
<?
$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…
Ok one more
$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
Kingofl337:
Ok one more
$Print_Version = $Current_Version[0].'.'.$Current_Version[1].'.'.$Current_Version[2].'.'.$Current_Version[3];
$comment='<font color="red"><b>'.$Current_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
Cuog
January 25, 2007, 7:45pm
#8
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.