PHP Classes

Lucky Numbers: Generate numbers from text using numerology

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 234 All time: 8,110 This week: 455Up
Version License PHP version Categories
lucky 1.0GNU General Publi...5Algorithms, PHP 5, Games
Description 

Author

This class can generate numbers from text using numerology principles.

It can take a given string of words or lines of text and generate a sequence of up to specified number of values.

The returned values are those with the highest frequency of values first: the lucky numbers.

Innovation Award
PHP Programming Innovation award nominee
October 2015
Number 9
Numerology is a belief that some people have that relates numbers with coincident events.

This class can generate eventually lucky numbers from given words. The words could be for instance the name of a person willing to find his/her own lucky numbers.

Manuel Lemos
Picture of Dave Smith
  Performance   Level  
Name: Dave Smith is available for providing paid consulting. Contact Dave Smith .
Classes: 51 packages by
Country: United States United States
Age: 59
All time rank: 608 in United States United States
Week rank: 50 Up7 in United States United States Up
Innovation award
Innovation award
Nominee: 32x

Winner: 7x

Example

<?php
/*
generate numbers from text using numerology
lucky number class 1.0
*/

//include class
include('luckynum.class.php');

//instantiate object
$luckyNum = new luckyNum();

//process user input
if( !empty($_REQUEST['posted']) ){
   
   
//flag to process each line instead of words
   
$useLine = ( empty($_REQUEST['useLine']) ) ? false : true;
   
   
//amount of numbers to find
   
$luckyNum->setNumberCount($_REQUEST['numberCount']);
   
   
//find numbers within this range
   
$luckyNum->setNumberRange($_REQUEST['lowRange'],$_REQUEST['highRange']);
   
   
//text to process
   
$luckyText = $_REQUEST['luckyText'];
   
   
//process text
    //note: you can run this method as many times as you wish with additional text before getting results
   
$luckyNum->processLuckyText($luckyText,$useLine);
   
   
//get results
   
$luckyResult = $luckyNum->getLuckyResult();
   
}else{
//or set form defaults
   
$_REQUEST['numberCount'] = $luckyNum->numberCount;
   
$_REQUEST['lowRange'] = $luckyNum->lowRange;
   
$_REQUEST['highRange'] = $luckyNum->highRange;
   
$_REQUEST['luckyText'] = '';
   
}

?>
<html>
    <head>
        <title>Lucky Number Testing</title>
    </head>
    <body>
        <h3>Generate Lucky Numbers</h3>
        <h4>The lucky number class uses numeroligy to generate numbers from any supplied text. By default each word will represent a number, however you can also set it so that each line represents a number.</h4>
        <form method="POST">
            Lucky Numbers to Generate:<br>
            <input type="text" name="numberCount" value="<?PHP echo $_REQUEST['numberCount'];?>"><br><br>
            Low Number Range:<br>
            <input type="text" name="lowRange" value="<?PHP echo $_REQUEST['lowRange'];?>"><br><br>
            High Number Range:<br>
            <input type="text" name="highRange" value="<?PHP echo $_REQUEST['highRange'];?>"><br><br>
            Your Lucky Text:<br>
            <textarea name="luckyText" style="width: 600px;height: 200px;"><?PHP echo $_REQUEST['luckyText'];?></textarea><br>
            <input type="checkbox" name="useLine"<?PHP echo ( empty($_REQUEST['useLine']) ) ? '' : ' checked';?>> Calculate lucky numbers from each line<br><br>
            <input type="hidden" name="posted" value="1"><input type="submit" name="formSubmit" value="Get Lucky Numbers">
       </form
<?php
if( !empty($luckyResult) ){
?>
<div>
            Lucky numbers requested: <?PHP echo $luckyResult['numberCount'];?><br>
            Lucky numbers found: <?PHP echo $luckyResult['resultCount'];?><br>
            Your lucky numbers: <strong><?PHP echo $luckyResult['resultSet'];?></strong>
        </div>
        <hr>
        <div>
            Object Values<br>
            <?PHP var_dump($luckyNum);?>
</div>
<?php
}
?>
</body>
</html>


Details

Class: luckynum Version: 1.0 9/28/2015 Copyright 2015 Wagon Trader, All Rights Reserved Description: This class will generate a number set from supplied text based on the principles of numerology. Files: luckynum.class.php - Main class example.php - Simple application example Installation: Upload files to a web accessible location on your server (eg. public_html) Configuration: You can change the following settings in the class to meet your specific needs... $numberCount - Default amount of number to find, this value can be changed during the scripts operation. $lowRange - Default lowest value of valid number, this value can be changed during the scripts operation. $highRange - Default highest value of valid number, this value can be changed during the scripts operation. Usage: Refer to example.php file for usage example. Refer to luckynum.class.php file for instructions on using methods Changelog 1.0 Initial release

  Files folder image Files (4)  
File Role Description
Accessible without login Plain text file example.php Example Example Usage
Accessible without login Plain text file license.txt Lic. License
Plain text file luckynum.class.php Class Main Class
Accessible without login Plain text file manual.txt Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:234
This week:0
All time:8,110
This week:455Up