/ LJCPHPCodeDoc / LJCCommonLib / Output / LogValue


Parameters
$lineNumber - The debug line number.
$valueName - The value name.
$value - The value.
$output - Indicates if value is output.

Syntax

PHP
public function LogValue(int $lineNumber, ?string $valueName, $value
, bool $output = true): string

Outputs the value text.

Example

PHP
 // Outputs the value text.
 private static function LogValue()
 {
   $output = new Output("CommonTest", "Output.LogValue");
   $output->Method = "Output.LogValue";
 
   // Cast array to stdClass object.
   $object = (object) [
     "Name" => "John",
     "Number" => 5,
   ];
   $value = LJC::CreateJSON($object);
   $lineNumber = __line__;
   // Log value.
   $result = $output->LogValue($lineNumber, "\$value", $value, output: false);
 
   $compare = "\r\n{$lineNumber} \$value = {\"Name\":\"John\",\"Number\":5}";
   LJC::OutputLogCompare("Output.Log()", $result, $compare);
 }

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.