filename.stdout.txt // test progress is seen on stderr, and stdout is useful json test artifact. use ZxcvbnPhp\Zxcvbn; $user_input_init = ["howmarket", "how", "market", "allhappy", "all", "happy", "hourse & sail", "hourse", "sail", "tree road", "tree", "road", "harrysliver", "harry", "sliver", "no_such_user@no_such_domain.gmail.com", ]; $test_passwords = [ "little_password1" => "foobar", "little_password2" => "A.little.293!", "big_password1" => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "big_password2" => "Punk Rock Punk Rock Punk Rock Punk Rock Punk Rock Punk Rock Punk Rock Punk Rock Punk Rock Punk Rock Punk Rock Punk Rock Punk Rock Punk Rock Punk Rock Punk Rock Punk Rock Punk Rock Punk Rock Punk Rock Punk Rock Punk Rock", "big_password3" => str_replace("\n", " ", "How can we address the current judicial crisis in Israel in a way that promotes democracy and equality for all, and maintains the trust and support of American Jewry? How can we reconcile our love for Israel with our concerns about the erosion of democratic norms and the rule of law in the country? How can we support the efforts of those in Israel who are working to uphold the principles of democracy and justice, and to heal the divides within Israeli society? How can we ensure that our support for Israel aligns with our values of democracy and equality, and that we engage in constructive dialogue and action to address the current challenges facing the country?"), ]; $all_output = []; $stderr = fopen('php://stderr', 'w'); foreach($test_passwords as $password_name => $password_plaintext) { $t0 = microtime(true); fwrite($stderr, "Testing password_name=$password_name\n"); try { $utility = new \ZxcvbnPhp\Zxcvbn(); $result = ['value' => $utility->passwordStrength($password_plaintext, $user_input_init)]; } catch (\Throwable $e) { $result = ['error' => ['class' => get_class($e), 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]]; } $t1 = microtime(true); $result['performance'] = ['dt' => round($t1 - $t0, 3), 'strlen' => strlen($password_plaintext)]; $all_output[$password_name] = $result; } fwrite($stderr, "All Done\n"); echo json_encode($all_output, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_PARTIAL_OUTPUT_ON_ERROR) . "\n";