PDA

View Full Version : My Very First Program!



SyntaXmasteR
09-13-2007, 09:00 PM
My Very First Output
I would like to share with you the very first output I created in PHP. This is the easiest output you can create using PHP! New coders are **.*% successful when writing a program such as to function just as this one does. If you can not duplicate this output, please give up trying to code... You are completely hopeless. Confused? You should be! :cool: SORRY! You do not get any notes :cool:



<?
$fill_array=array(
"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0",
"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0",
"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0"
);

$bits= array(
"00","0*","*0","**"
);

$locations= array(
"00" => array(
"0*", "0*", "**", "*5", "20",
"22", "2*", "*4", "**", "4*",
"44", "46"
),
"0*" => array(
"00", "04", "06", "07", "08",
"*2", "*6", "24", "25", "26",
"28", "*2", "*6", "40", "42",
"47"
),
"*0" => array(
"02", "05", "0*", "**", "*7",
"2*", "2*", "*5", "*7", "4*",
"45"
),
"**" => array(
"*0", "*4", "*8", "**", "27",
"*0", "**", "**", "*8"
)
);

while(isset($bits[0])){
$random_num=rand(0,(count($bits)-*));
$random_bit=$bits[$random_num];
$random_location=rand(0,(count($locations[$random_bit])-*));
$fill_array[(int)$locations[$random_bit][$random_location]]=$random_bit;
unset($locations[$random_bit][$random_location]);
$locations[$random_bit]=array_values($locations[$random_bit]);
if(count($locations[$random_bit])==0){
unset($locations[$random_bit]);
$locations[$random_bit]=array_values($locations[$random_bit]);
unset($bits[$random_num]);
$bits=array_values($bits);
}
}

$binary=implode("",$fill_array);
$i=*;$bits=NULL;
while(isset($binary[$i-*])){
$bits .= $binary[$i-*];
if($i%8==0){
print_r(chr(bindec($bits)));
$bits=NULL;
}
$i++;
}
?>

JayT
09-13-2007, 11:49 PM
Wouldn't it have been easier to write:


print "Hello World!";

???

Mr. Complicated!


LOL


I get many notices and warnings trying to run it using PHP v4.4.4


I get:



Notice: Undefined index: *0 in D:\inetpub\wwwroot\TESTS\test.php on line 45

Warning: array_values() [function.array-values]: The argument should be an array in D:\inetpub\wwwroot\TESTS\test.php on line 45

Notice: Undefined index: 00 in D:\inetpub\wwwroot\TESTS\test.php on line 45

Warning: array_values() [function.array-values]: The argument should be an array in D:\inetpub\wwwroot\TESTS\test.php on line 45

Notice: Undefined index: ** in D:\inetpub\wwwroot\TESTS\test.php on line 45

Warning: array_values() [function.array-values]: The argument should be an array in D:\inetpub\wwwroot\TESTS\test.php on line 45

Notice: Undefined index: 0* in D:\inetpub\wwwroot\TESTS\test.php on line 45

Warning: array_values() [function.array-values]: The argument should be an array in D:\inetpub\wwwroot\TESTS\test.php on line 45

SyntaXmasteR
09-14-2007, 11:38 AM
Update your PHP :cool: ...

Notice its throwing those notices every time it completely empties an array. 00,0*,*0,**.

The array is empty on PHP4 and cannot array_values() because there are no values in the array. PHP5 Accepts this and does not throw any warnings.

Moonbat
09-14-2007, 03:02 PM
SyntaX, you've been dabbling in code obfuscation way too long... :eek:

SyntaXmasteR
09-14-2007, 03:13 PM
Forget syntax******, I think I'll create a new account for SynTobfuscator!

Ezekiel
09-14-2007, 03:45 PM
Don't you have a network admin job? Even as an unemployed adolescent, I wouldn't have enough time to write random code just to flex my coding skills.

Nice code in any case.

SyntaXmasteR
09-14-2007, 04:34 PM
Its array awareness week. I'm just celebrating! So where is your array? Your not invited without one...

Actually I was just learning the behaviors of different types of arrays, and how to move values around without completely destroying your array structure. Its harder than you think, but more useful than you think.

Ezekiel
09-15-2007, 06:39 AM
So in other words, a slow day at work ;).

Did you look up each ASCII character's decimal equivalent? I imagine that'd take quite some time, unless you have the entire ASCII table memorised. That would be a cool skill.

SyntaXmasteR
09-15-2007, 11:34 AM
Work? Whats work? I dont ever work. Its all play.

Well, I know that a space is "*2", "A" starts at 65 and "a" starts at *7... and I can add :cool:

Oh yeah theres that explanation point... had to look that one up.

JayT
09-15-2007, 02:40 PM
Work? Whats work? I dont ever work. Its all play.

Well, I know that a space is "*2", "A" starts at 65 and "a" starts at *7... and I can add :cool:

Oh yeah theres that explanation point... had to look that one up.



WORK !???
Obviously, the BBS obscenity filter is NOT working.
LOL






Perhaps these two native PHP functions could prove useful:




print ord("a"); // Print ASCII code of character "a"


print chr(65); // Print character corresponding to ASCII code 65



A quick and simple ASCII table:




$out = "DEC\tCHR\tHEX<BR>\n";


for ($i=*2; $i < *2*; $i++)
{
$out .= "$i\t" . chr($i) . "\t" . StrToUpper(DecHex($i)) . "<BR>\n";
}

print "<PRE>$out</PRE>";

SyntaXmasteR
09-15-2007, 02:48 PM
Yeah, I think we need to get that obscenity filter fixed!
I only had to add the chr to the output of the binary bits:


print_r(chr(bindec($bits)));

Ezekiel
09-15-2007, 05:35 PM
Well, I know that a space is "*2", "A" starts at 65 and "a" starts at *7... and I can add :cool:


That'd be a somewhat awesome party-piece.

You: "I can speak fluent ASCII."

Someone else: "77 *0* ** **6 *** ***"

Ezekiel
09-16-2007, 04:47 AM
I think you mean an exclamation point. (http://www.encyclopediadramatica.com/images/5/5*/Grammar_Nazi.gif)