RGriffiths
RGriffiths

Reputation: 5970

Calculating the length of a string using fphp

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?

Upvotes: 0

Views: 52

Answers (1)

Orangepill
Orangepill

Reputation: 24665

Just Test for the length of the string:

if (strlen((string)$obsComment) > 0) 

Upvotes: 2

Related Questions