+1 vote
ago by
I want to convert a number to a string, but it does not work. I get ones.
$response .= "$pname"." x ". strval($pcount) . "\n". settype($soldprice,"string") . " x " . ((string)$pcount) . " = " . $ptotal ."\n";

Cherniy x 1
1 x 1 = 1
ago by
I apologize for the inconvenience. There was an error in getting the variables.

2 Answers

0 votes
ago by
 
Best answer
$soldprice = 123;
echo(" x " . $soldprice);
0 votes
ago by
$response = sprintf(
"%s × %d\n%d × %d = %d",
$pname,
$pcount,
$soldprice,
$pcount,
$ptotal
);
ago by
pxp does not need any special function "to convert a number to a string"
the author has no problems
question for deletion
...