var_export

Supported Versions: PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8
Outputs or returns a parsable string representation of a variable
<?php var_export(mixed $value, bool $return = false): ?string
<?php     protected function getStorableEnumValue($expectedEnum, $value)

    {

        if (! $value instanceof $expectedEnum) {

            throw new ValueError(sprintf('Value [%s] is not of the expected enum type [%s].', var_export($value, true), $expectedEnum));

        }



        return $value instanceof BackedEnum
<?php         $configPath = $this->laravel->getCachedConfigPath();



        $this->files->put(

            $configPath, '<?php return '.var_export($config, true).';'.PHP_EOL

        );



        try {
<?php         file_put_contents(

            $this->laravel->getCachedEventsPath(),

            '<?php return '.var_export($this->getEvents(), true).';'

        );



        $this->components->info('Events cached successfully.');
<?php     {

        $stub = $this->files->get(__DIR__.'/stubs/routes.stub');



        return str_replace('{{routes}}', var_export($routes->compile(), true), $stub);

    }

}
<?php         }



        $this->files->replace(

            $this->manifestPath, '<?php return '.var_export($manifest, true).';'

        );

    }

}
<?php         }



        $this->files->replace(

            $this->manifestPath, '<?php return '.var_export($manifest, true).';'

        );



        return array_merge(['when' => []], $manifest);
<?php     protected function formatMessage($message)

    {

        if (is_array($message)) {

            return var_export($message, true);

        } elseif ($message instanceof Jsonable) {

            return $message->toJson();

        } elseif ($message instanceof Arrayable) {
<?php         } elseif ($message instanceof Jsonable) {

            return $message->toJson();

        } elseif ($message instanceof Arrayable) {

            return var_export($message->toArray(), true);

        }



        return (string) $message;
<?php             $f = new ComparisonFailure(

                $patched,

                $other,

                var_export($patched, true),

                var_export($other, true)

            );
<?php                 $patched,

                $other,

                var_export($patched, true),

                var_export($other, true)

            );



            $this->fail($other, $description, $f);
<?php     public function testWriteManifestStoresToProperLocation()

    {

        $repo = new ProviderRepository(m::mock(ApplicationContract::class), $files = m::mock(Filesystem::class), __DIR__.'/services.php');

        $files->shouldReceive('replace')->once()->with(__DIR__.'/services.php', '<?php return '.var_export(['foo'], true).';');



        $result = $repo->writeManifest(['foo']);
<?php         }



        $thisFile = __FILE__;

        $logfile = var_export($this->logfile, true);



        $script = <<<PHP

#!/usr/bin/env php
<?php         $this->expectException(ValueError::class);

        $this->expectExceptionMessage(

            sprintf('Value [%s] is not of the expected enum type [%s].', var_export(ArrayableStatus::pending, true), StringStatus::class)

        );



        $model->string_status = ArrayableStatus::pending;
<?php     public function testDeserializationOccursCorrectly()

    {

        $carbon = new Carbon('2017-06-27 13:14:15.000000');

        $serialized = 'return '.var_export($carbon, true).';';

        $deserialized = eval($serialized);



        $this->assertInstanceOf(Carbon::class, $deserialized);
<?php         if (is_scalar($value) || $value === null) {

            return new self(sprintf(

                'Could not convert PHP value %s to type %s. Expected one of the following types: %s',

                var_export($value, true),

                $toType,

                implode(', ', $possibleTypes)

            ), 0, $previous);