0

I've seen this question but the solution therein doesn't use the Laravel method.

I wanna do something like this:

$this->info('This is the result: ', $result);
2
  • You could make your own $this->infoAndLog function in your class that calls $this->info() and does something else. (Or extend the info() function.) Commented Mar 19, 2019 at 19:06
  • What about $this->info('This is the result: ' . print_r($result, true)); ? Commented Nov 22, 2022 at 12:53

3 Answers 3

2

I believe you are looking for:

$output = new \Symfony\Component\Console\Output\ConsoleOutput(2);

$output->writeln('This is the result: ', $result);
Sign up to request clarification or add additional context in comments.

Comments

0

Try this

$this->info('This is the result: ');
dump($result);

You can use dump() for print print objects

Comments

0

Btw, Do you know you can include variable inside double quote to output, the first basic thing of php. $this->info("This is the result: {$result}")

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.