PHP code example of dbeurive / util

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

    

dbeurive / util example snippets


$data = ['A', 'B', 'C'];
UtilData::to_callable_php_file($data, '/path/to/your/file.php');
// ...
$newData = 

$result = UtilCode::

UtilMySql::quoteFieldName('id');            // => '`id`'
UtilMySql::quoteFieldName('user.id');       // => '`user`.`id`'
UtilMySql::quoteFieldName('prod.user.id');  // => '`prod`.`user`.`id`'

UtilMySql::quoteFieldsNames(['id', 'login', 'password']);                           // => ['`id`', '`login`', '`password`']
UtilMySql::quoteFieldsNames(['user.id', 'login', 'password']);                      // => ['`user`.`id`', '`login`', '`password`']
UtilMySql::quoteFieldsNames(['id', 'login', 'password'], 'user');                   // => ['`user`.`id`', '`user`.`login`', '`user`.`password`']
UtilMySql::quoteFieldsNames(['user.id', 'login', 'password'], 'user');              // => ['`user`.`id`', '`user`.`login`', '`user`.`password`']
UtilMySql::quoteFieldsNames(['db.user.id', 'login', 'password'], 'user');           // => ['`db`.`user`.`id`', '`user`.`login`', '`user`.`password`']
UtilMySql::quoteFieldsNames(['user.id', 'login', 'password'], 'user', 'prod');      // => ['`prod`.`user`.`id`', '`prod`.`user`.`login`', '`prod`.`user`.`password`']
UtilMySql::quoteFieldsNames(['prod.user.id', 'login', 'password'], 'user', 'prod'); // => ['`prod`.`user`.`id`', '`prod`.`user`.`login`', '`prod`.`user`.`password`']

UtilMySql::qualifyFieldName('id', 'user');               // => 'user.id'
UtilMySql::qualifyFieldName('user.id','user');           // => 'user.id'
UtilMySql::qualifyFieldName('db.user.id', 'user');       // => 'db.user.id'
UtilMySql::qualifyFieldName('id', 'user', 'db');         // => 'db.user.id'
UtilMySql::qualifyFieldName('user.id', 'user', 'db');    // => 'db.user.id'
UtilMySql::qualifyFieldName('db.user.id', 'user', 'db'); // => 'db.user.id'

UtilMySql::qualifyFieldsNames(['id', 'login'], 'user');                   // => ['user.id', 'user.login']
UtilMySql::qualifyFieldsNames(['user.id', 'login'], 'user');              // => ['user.id', 'user.login']
UtilMySql::qualifyFieldsNames(['id', 'login'], 'user', 'prod');           // => ['prod.user.id', 'prod.user.login']
UtilMySql::qualifyFieldsNames(['user.id', 'login'], 'user', 'prod');      // => ['prod.user.id', 'prod.user.login']
UtilMySql::qualifyFieldsNames(['prod.user.id', 'login'], 'user', 'prod'); // => ['prod.user.id', 'prod.user.login']

UtilUnitTest::call_private_or_protected_static_method('ClassToTest', '__privateStatic', 10);
UtilUnitTest::call_private_or_protected_method('ClassToTest', '__privateNonStatic', $o, 10); // $o is an instance of class "ClassToTest".