1. Go to this page and download the library: Download sokil/php-bitmap library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sokil / php-bitmap example snippets
class PhpError extends \Sokil\Bitmap
{
/**
* Show errors
* Set first bit, which represents E_ERROR, to "1"
*/
public function showErrors()
{
$this->setBit(0);
return $this;
}
/**
* Hide errors
* Set first bit, which represents E_ERROR, to "0"
*/
public function hideErrors()
{
$this->unsetBit(0);
return $this;
}
/**
* Check if errors shown
* Check if first bit set to 1
*/
public function isErrorsShown()
{
return $this->isBitSet(0);
}
/**
* Show warnings
* Set second bit, which represents E_WARNING, to "1"
*/
public function showWarnings()
{
$this->setBit(1);
return $this;
}
/**
* Hide warnings
* Set second bit, which represents E_WARNING, to "0"
*/
public function hideWarnings()
{
$this->unsetBit(1);
return $this;
}
/**
* Check if warnings shown
* Check if second bit set to 1
*/
public function isWarningsShown()
{
return $this->isBitSet(1);
}
}
// load current error levels
$error = new PhpError(error_reporting());
// enable errors and warnings
$error->showErrors()->showWarnings();
// set error reporting
error_reporting($error->toInt());
// check if warnings shown
var_dump($error->isWarningsShown());
// value may be set by mask
// E_USER_ERROR | E_USER_WARNING is 256 + 512;
$error->setBitsByMask(E_USER_ERROR | E_USER_WARNING);