Page 1 of 1

php tricky format

Posted: 2019-09-16 06:49
by D Oliveira
how to turn this

Code: Select all

$day = '1';
$pdf->MultiCell(20,20,$treinocardio11['cal$day'],0,'C',false);  
into this:

Code: Select all

$pdf->MultiCell(20,20,$treinocardio11['cal1'],0,'C',false);  
any ideas?

Re: php tricky format

Posted: 2019-09-16 06:52
by jsetzer
Try this:

$day = '1';
$pdf->MultiCell(20,20,$treinocardio11["cal{$day}"],0,'C',false);

Re: php tricky format

Posted: 2019-09-16 06:54
by D Oliveira
jsetzer wrote:
2019-09-16 06:52
Try this:

$day = '1';
$pdf->MultiCell(20,20,$treinocardio11["cal{$day}"],0,'C',false);
didnt work, i think this is illegal format

Re: php tricky format

Posted: 2019-09-16 06:56
by jsetzer

Code: Select all

$day = '1';
$variable = $treinocardio11["cal{$day}"];

var_dump($variable);
exit;

$pdf->MultiCell(20,20,$variable ,0,'C',false);
can you post output please

Re: php tricky format

Posted: 2019-09-16 06:57
by D Oliveira
jsetzer wrote:
2019-09-16 06:56

Code: Select all

$day = '1';
$variable = $treinocardio11["cal{$day}"];

var_dump($variable);
exit;

$pdf->MultiCell(20,20,$variable ,0,'C',false);
can you post output please
oops, my code had a typo $day_, your solution worked perfectly, thank you and sorry for wrong feedback

Re: php tricky format

Posted: 2019-09-16 07:04
by jsetzer
OK, great!