0

I am using fphp to create a pdf using data retrieved from an SQL database. Is works fine but I want to only display information where there is data in the database. For example I only want the following line to be executed if the length of $obsComment is greater than 0.

$pdf->MultiCell(0, 5, $obsComment,0, "J");

How do I calculate the length of a string using fphp? I have tried:

If (GetStringWidth(string $obsComment)>0)
{
$pdf->MultiCell(0, 5, $obsComment,0, "J");
}

but this does not work. Any ideas?

4

1 回答 1

2

只需测试字符串的长度:

if (strlen((string)$obsComment) > 0) 
于 2013-06-12T15:35:52.833 回答