Skip to content

[Feature Request] Universal examples regardless of browser or CLI #102

@timint

Description

@timint

It's been extremely handy to use CLI with testing the examples.

I am here proposing a univeral way for both browser and CLI output:

<?php

  error_reporting(E_ALL);
  ini_set('display_errors', 'On');

  // Output handler
  ob_start(function($buffer){
    return (php_sapi_name() != 'cli') ? '<pre>'.htmlspecialchars($buffer).'</pre>' : $buffer;
  });

  // Do your stuff
  // ...

  var_dump('some output');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions