PHP code example of tadaspaplauskas / anyway

1. Go to this page and download the library: Download tadaspaplauskas/anyway 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/ */

    

tadaspaplauskas / anyway example snippets


in_array([1, 2, 3], 2);

// TypeError
// in_array(): Argument #2 ($haystack) must be of type array, int given

use Anyway;

Anyway::in_array([1, 2, 3], 2);

// true

Anyway::in_array(4, [1, 2, 3]);

// false

use Anyway;

Anyway::in_array([1, 2, 3], fn () => 'what?');

// ErrorException
// Object of class Closure could not be converted to int