NameSilo

PHP Help!

Spaceship Spaceship
Watch

stringerbell

Established Member
Impact
1
Hey Guys,

I need a little bit of PHP code, so I thought I'd come here and offer $7.77 (PayPal) to the first person that posts the required bit of code for me!

Here's the specs:

- PHP code (that could be pasted into a Wordpress PHP widget for instance).
- No calling data files if possible (the whole thing works inside the PHP code itself). Wouldn't want problems finding the right data-file in case I change directories/servers/websites or something.
- What it does: When the page loads, the PHP code goes out and creates a paragraph randomly out of different bits of data. For instance, say it goes and gets a radom item out of the data sets (greeting), (opening), (middle), (closing), (salutation), (signature). And, say you have 5 or 10 different greetings in the 'greeting' set, 5 or 10 different opening sentences in the 'opening' set, 5 or 10 different middle sentences in the 'middle' set, etc... So, you end up with a letter of what appears to be original content (in this case you have {5 to the power of 6} or {10 to the power of 6} different possible paragraphs as output). The output doesn't have to be formatted in any way, just a simple text paragraph is perfectly fine, and you don't have to fill anything in in the data sets (greeting 1, greeting 2, etc... or 1, 2, 3... is fine).

It should be pretty easy code to write, I just don't know enough about PHP to call random bits of data. So, as I mentioned, $7.77 for the first person to post proper, working PHP code!

Thanks!
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable DomainsUnstoppable Domains
PHP:
<?php

$data['greetings'] = array('Hello,','Look Who It Is!','Hey,','Hi,','Howdy,');
$data['openings'] = array('Opening 1','Opening 2','Opening 3','Opening 4','Opening 5');
$data['middles'] = array('Middle 1','Middle 2','Middle 3','Middle 4','Middle 5');
$data['closings'] = array('Closing 1','Closing 2','Closing 3','Closing 4','Closing 5');
$data['salutations'] = array('Salutation 1','Salutation 2','Salutation 3','Salutation 4','Salutation 5');
$data['signatures'] = array('Signature 1','Signature 2','Signature 3','Signature 4','Signature 5');
$letter = '';

foreach ($data as $dataset) {
	$letter .= $dataset[mt_rand(0,count($dataset)-1)] . ' ';
}
		  
echo $letter;

?>
 
Last edited:
0
•••
Thanks!

PP sent. Thread closed...
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back