PHP code example of ppabcd / helpers

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

    

ppabcd / helpers example snippets


  $data = 'Test String "';
  Str::strip_quotes($data);

  $data = 'Test String \' ';
  Str::strip_slashes($data);

  Str::random(); // Default is alnum
  Str::random(18,'alnum'); //Alnum result
  Str::random(18,'alpha'); //Alpha result
  Str::random(18,'numeric'); //Numeric result
  Str::random(18,'md5'); //MD5 result
  Str::random(18,'hex'); //Hex result
  Str::random(18,'binary'); //Binary result

  for ($i = 0; $i < 10; $i++)
      {
        echo Str::alternator('one', 'two', 'three', 'four', 'five');
      }

    $data = 'tESt stRinG';
    Str::reverse_case($data);
    // Test String

    $data = 'test strinG';
    Str::title_case($data);
    // Test String

    $data = 'test string';
    Str::limit($data, 4);
    // test

    $data = 'test string';
    Str::contains($data, 'test');
    // true

    $data = 'example_test-string';
    Str::camelize($data);
    // ExampleTestString

    $array = [
      'pizza pie' => 'nomnom',
      'hot dog' => 'ohnomnom'
    ];
    
    Str::array_key_starts_with($array, 'hot');
    // ['hot dog' => 'ohnomnom']

    $array = [
      'pizza pie' => 'nomnom',
      'hot dog' => 'ohnomnom'
    ];
    
    Str::array_key_ends_with($array, 'pie');
    // ['pizza pie' => 'nomnom']

    $array = [
      'foo' => 'bar'
    ];
    
    Str::arrays_match($array, $array);
    // true

    $string = 'heLLo World ya`ll';
    
    Str::snake_case($string));
    // hello_world_ya`ll
    # With delimiter
    Str::snake_case($string, '-'));
    // hello-world-ya`ll

    $string = 'Hello WorLD';
    
    Str::lower_case($string));
    // hello world

    $string = 'Hello WorLD';
    
    Str::upper_case($string));
    // HELLO WORLD