Coder Social home page Coder Social logo

fileinout's Introduction

FileInOut

Descripción

Con esta clase de PHP podemos obtener los datos en formato Array de un archivo .in y configurar el formato que queramos que tenga el Array.

Con esta clase de PHP podemos crear un archivo .out enviándole un parámetro tipo String a la función encargada.

Description

With this kind of PHP we can get the data into a format Array .in file and set the format you want to have the Array.

With this kind of PHP we can create a .out file sent to you one type String parameter to the function responsible.

Example of use

$arrDatos = GenerateInOut::getFileInToArray('A-small-practice.in', array('first' => 1,'data'  => 3,));
$strResult = '';
foreach ($arrDatos['data'] as $i => $arrDato) {
    $intNCase = $i + 1;
    $arrProduct = explode(' ', $arrDato[2]);
    $strResult .= "Case #{$intNCase}: ";
    foreach ($arrProduct as $key => $producto) {
        if((int) $producto  <  (int) $arrDato[0]){
            $arrProductsFilter[$key] = $producto;
        }
    }
    $bln = false;
    foreach ($arrProductsFilter as $key => $productFilter) {
        foreach ($arrProductsFilter as $key2 => $productFilter2) {
            if ((int)$key < (int)$key2) {
                if (((int)$productFilter + (int)$productFilter2) == (int)$arrDato[0]) {
                    $value1 = $key + 1;
                    $value2 = $key2 + 1;
                    $strResult .= "{$value1} {$value2}" . PHP_EOL;
                    $bln = true;
                    //break;
                }
            }
        }
    }
}
echo GenerateInOut::setStringOutFile($strResult);

fileinout's People

Contributors

miguelcast avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.