PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Anthony Rogers   PHP Split Number   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Test and Example Page
Class: PHP Split Number
Split a long number into an array of smaller parts
Author: By
Last change: A couple of spelling corrections.
Date: 8 years ago
Size: 1,410 bytes


Class file image Download
<title>Test and Example Page for Number Splitter-Upper</title>
    text-align: center;
<h1 class='centre'>Test and Example Page for Number Splitter-Upper</h1>
//Require class
//For now, just random numbers
  //$really_long_inputted_number has to be a string due to a max size on integers
$really_long_inputted_number = '87072316419618716160154502113081209718540150034117075017641332';
//Max size to split up the numbers
$inputted_max_number = 87;
//Makes calling the function several times so much easier
$return_type = 'string';
$join = ', ';
$filter_zeros = true;
$remove_zeros = true;
//Create instance
$n = new Number_Splitter_Upper($really_long_inputted_number, $inputted_max_number);
<h2>Inputted numbers</h2>
<h3>Really long number to break up</h3>
echo $really_long_inputted_number;
<h3>Maximum number size</h3>
echo $inputted_max_number;
<h2>Echo the numbers to screen</h2>
->the_numbers( $join, $filter_zeros, $remove_zeros );
<h2>Return the numbers for php use</h2>
( $n->get_numbers( 'array', $join, $filter_zeros, $remove_zeros ) );