3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace SComparison; class Comparator { protected $_strings = array(); protected $_tests = array(); protected $_hash; public function __construct() { $this->_hash = new SHash(); } /** * converting input data */ protected function _prepareInput() { foreach ($this->_strings as $key => $string) { $this->_tests[$key] = str_replace(" ", "", strtolower($string)); } } protected function _outputInteractive($key) { echo "String: " . $this->_strings[$key] . "\n"; echo "Test: " . $this->_tests[$key] . "\n"; echo "Hash: " . $this->_hash->getHash(SHash::HASH_BIN) . " - " . $this->_hash->getHash() . "\n"; echo "-----------------------------------------------------------\n"; } /** * executing comparison action */ public function runInteractive() { $this->_prepareInput(); foreach ($this->_tests as $key => $test) { $this->_hash->setString($test); $this->_hash->getHash(); $this->_outputInteractive($key); } } public function runCL() { $this->_prepareInput(); foreach ($this->_tests as $key => $test) { $this->_hash->setString($test); $this->_hash->getHash(); $this->_outputInteractive($key); } } public function setStrings(array $strings) { $this->_strings = $strings; } }

preferences:
41.66 ms | 402 KiB | 5 Q