Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php declare(strict_types=1); namespace PhpOffice\PhpSpreadsheetTests\Calculation; use..

Decoded Output download

<?php

declare(strict_types=1);

namespace PhpOffice\PhpSpreadsheetTests\Calculation;

use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PHPUnit\Framework\TestCase;

class NullEqualsZeroTest extends TestCase
{
    public function testNullEqualsZero(): void
    {
        // Confirm that NULL<>0 returns false
        $spreadsheet = new Spreadsheet();
        $sheet = $spreadsheet->getActiveSheet();
        $sheet->fromArray([
            ['Item', 'QTY', 'RATE', 'RATE', 'Total'],
            ['Bricks', 1000, 'Each', 0.55, '=IF(B2<>0,B2*D2,"INCL.")'],
            ['Cement', null, null, null, '=IF(B3<>0,B3*D3,"INCL.")'],
            ['Labour', 10, 'Hour', 45.00, '=IF(B4<>0,B4*D4,"INCL.")'],
        ]);
        $sheet->setCellValue('A6', 'Total');
        $sheet->setCellValue('E6', '=SUM(E1:E5)');
        self::assertEquals(550.00, $sheet->getCell('E2')->getCalculatedValue());
        self::assertSame('INCL.', $sheet->getCell('E3')->getCalculatedValue());
        self::assertEquals(450.00, $sheet->getCell('E4')->getCalculatedValue());
        self::assertEquals(1000.00, $sheet->getCell('E6')->getCalculatedValue());

        $sheet->setCellValue('Z1', '=Z2=0');
        self::assertTrue($sheet->getCell('Z1')->getCalculatedValue());
        $spreadsheet->disconnectWorksheets();
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

namespace PhpOffice\PhpSpreadsheetTests\Calculation;

use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PHPUnit\Framework\TestCase;

class NullEqualsZeroTest extends TestCase
{
    public function testNullEqualsZero(): void
    {
        // Confirm that NULL<>0 returns false
        $spreadsheet = new Spreadsheet();
        $sheet = $spreadsheet->getActiveSheet();
        $sheet->fromArray([
            ['Item', 'QTY', 'RATE', 'RATE', 'Total'],
            ['Bricks', 1000, 'Each', 0.55, '=IF(B2<>0,B2*D2,"INCL.")'],
            ['Cement', null, null, null, '=IF(B3<>0,B3*D3,"INCL.")'],
            ['Labour', 10, 'Hour', 45.00, '=IF(B4<>0,B4*D4,"INCL.")'],
        ]);
        $sheet->setCellValue('A6', 'Total');
        $sheet->setCellValue('E6', '=SUM(E1:E5)');
        self::assertEquals(550.00, $sheet->getCell('E2')->getCalculatedValue());
        self::assertSame('INCL.', $sheet->getCell('E3')->getCalculatedValue());
        self::assertEquals(450.00, $sheet->getCell('E4')->getCalculatedValue());
        self::assertEquals(1000.00, $sheet->getCell('E6')->getCalculatedValue());

        $sheet->setCellValue('Z1', '=Z2=0');
        self::assertTrue($sheet->getCell('Z1')->getCalculatedValue());
        $spreadsheet->disconnectWorksheets();
    }
}

Function Calls

None

Variables

None

Stats

MD5 f237840228bdfe1d6adfdcc9777d987c
Eval Count 0
Decode Time 91 ms