TinyChan

Topic: halp pls

+Anonymous A8.3 years ago #50,017

What is going on here? I've got two scripts as follows:

Circle.php
<?php
class Circle{
	public $radius = 0;

	function __construct($r = 0){
		$this->setRadius = $r;
		echo '<p>In the circle constructor.</p>';
	}

	function __destruct(){
		echo '<p>In the circle destructor.</p>';
	}

	function setRadius($r = 0){
		if($r >= 1){
			$this->radius = $r;
		}else{
			$this->radius = 1;
		}
	}

	function getRadius(){
		return ($this->radius);

	function getPerimeter(){
		return(($this->radius * 3.14) * 2);
	}

	function getArea(){
		return (3.14 * ($this->radius * $this->radius));
	}
} //end of circle class


test.php
<html lang="en-US">
<head>
	<meta charset="ansi">
	<title>Test Circle</title>
</head>
<body>
<?php require('Circle.php');
function test(){
	$c = new Circle(3);
}
?>
</body>
</html>


When I run test.php it gives me this output:
> setRadius = $r; echo '

> In the circle constructor.
> '; } function __destruct(){ echo '

> In the circle destructor.
> '; } function setRadius($r = 0){ if($r >= 1){ $this->radius = $r; }else{ $this->radius = 1; } } function getRadius(){ return ($this->radius); function getPerimeter(){ return(($this->radius * 3.14) * 2); } function getArea(){ return (3.14 * ($this->radius * $this->radius)); } } //end of circle class

Why is it displaying the source of circle.php?

+Nugget Syntaxroll !Uvm54ORbmo8.3 years ago, 1 hour later[T] [B] #539,901

> $this->setRadius = $r;
you sure about this?

·Anonymous A (OP) — 8.3 years ago, 6 minutes later, 1 hour after the original post[T] [B] #539,902

@previous (Nugget Syntaxroll !Uvm54ORbmo)
Honestly I'm not sure about much of anything here. It's all pretty much brand new to me.

·Nugget Syntaxroll !Uvm54ORbmo8.3 years ago, 2 minutes later, 1 hour after the original post[T] [B] #539,903

@previous (A)
much the same here
but from the look of it you're trying to assign a value to a function
instead of calling a function with a value

·Anonymous A (OP) — 8.3 years ago, 5 minutes later, 1 hour after the original post[T] [B] #539,904

@previous (Nugget Syntaxroll !Uvm54ORbmo)
Yea, I'm supposed to be calling a function with a value but I don't exactly know what that looks like.

·Nugget Syntaxroll !Uvm54ORbmo8.3 years ago, 1 minute later, 1 hour after the original post[T] [B] #539,905

@previous (A)
try
> $this->setRadius($r);

+Anonymous C8.3 years ago, 2 hours later, 4 hours after the original post[T] [B] #539,907

did u try turning it off and on again

·Anonymous A (OP) — 8.3 years ago, 53 minutes later, 4 hours after the original post[T] [B] #539,916

@539,905 (Nugget Syntaxroll !Uvm54ORbmo)
Inside the constructor? Same result.

@previous (C)
I did a complete reinstall and everything!

·Nugget Syntaxroll !Uvm54ORbmo8.3 years ago, 12 minutes later, 5 hours after the original post[T] [B] #539,918

> function getRadius(){
> return ($this->radius);
>

missing close bracket

·Anonymous A (OP) — 8.3 years ago, 7 minutes later, 5 hours after the original post[T] [B] #539,919

@previous (Nugget Syntaxroll !Uvm54ORbmo)
Well thanks for catching that. Doesn't fix the script being dumped issue though.

·Nugget Syntaxroll !Uvm54ORbmo8.3 years ago, 16 minutes later, 5 hours after the original post[T] [B] #539,920

in test.php, rewrite the <?php> part:
<?php require('Circle.php');
$c = new Circle(3);
?>

+Anonymous D8.3 years ago, 1 hour later, 7 hours after the original post[T] [B] #539,921

I'll wager not one person in this thread can name 10 plays by Shakespeare or 5 films by Federico Fellini, yet THIS nerdtastic gibberish is a native tongue to you.

·Anonymous A (OP) — 8.3 years ago, 3 hours later, 10 hours after the original post[T] [B] #539,922

@previous (D)
I'll wager you're a retarded faggot because it's pretty obvious from the inability of anyone in here to make this work that it's clearly not a native tongue. Now fuck off and let the people with employable skills talk.

@539,920 (Nugget Syntaxroll !Uvm54ORbmo)
This added a fatal error!
> Fatal error: Class 'Circle' not found in K:\UniServerZ\www\testCircle.php on line 42
(line 42 is
$c = new Circle(3);
because of commented program requirements which I omitted from the OP for the sake of brevity)

·Anonymous D8.3 years ago, 32 minutes later, 11 hours after the original post[T] [B] #539,924

@previous (A)
> I'll wager you're a retarded faggot because it's pretty obvious from the inability of anyone in here to make this work that it's clearly not a native tongue. Now fuck off and let the people with employable skills talk.


> Says he has no idea what any of that gibberish means.

> Lauds his employable skills.

You're not very bright are you, failed nerd.

+Anonymous E8.3 years ago, 3 hours later, 14 hours after the original post[T] [B] #539,930

Try this:

Up up down down left right left right select start..

·Nugget Syntaxroll !Uvm54ORbmo8.3 years ago, 4 hours later, 19 hours after the original post[T] [B] #539,936

@539,922 (A)
ok now it is getting somewhere
try copying the whole Circle class from circle.php and paste it into test.php, remove the require (Circle.php) line, and run again

·Anonymous D8.3 years ago, 5 minutes later, 19 hours after the original post[T] [B] #539,937

@539,922 (A)
Or, just go read a book and get laid and stop caring about this stupid gibberish.

+Anonymous F8.3 years ago, 18 minutes later, 19 hours after the original post[T] [B] #539,939

1) The OP is using object oriented code which is a complete crap way to code. Rewrite it in procedural.
2) The code is incomplete to do anything. Both parts are incomplete. All it does now is create a variable and store it.

·Anonymous F8.3 years ago, 4 minutes later, 19 hours after the original post[T] [B] #539,940

@539,937 (D)
> Or, just go read a book and get laid and stop caring about this stupid gibberish.


If OP stopped using object oriented code, it would not be gibberish looking and she could get results.

object oriented code is what shiity 80 IQ H-1B Visa, job-stealing Indians code in and they just copy and paste. It creates the most awful shit and you see the results on Corporate websites.

You see how fast Tinychan runs? If Corporate H-1B people did this, it would be PURE JAVASCRIPT, buggy and only work on 1 browser, and each page would be 100 megs in size from all the bloat.

·Anonymous C8.3 years ago, 2 minutes later, 19 hours after the original post[T] [B] #539,942

I havent posted here in like a year how do I change the page theme to yotsuba?

·Nugget Syntaxroll !Uvm54ORbmo8.3 years ago, 10 minutes later, 19 hours after the original post[T] [B] #539,945

@previous (C)
> I havent posted here in like a year how do I change the page theme to yotsuba?

Stuff->Dashboard->Stylesheet

·Nugget Syntaxroll !Uvm54ORbmo8.3 years ago, 30 minutes later, 20 hours after the original post[T] [B] #539,946

@539,921 (D)
> I'll wager not one person in this thread can name 10 plays by Shakespeare or 5 films by Federico Fellini, yet THIS nerdtastic gibberish is a native tongue to you.
> Shakespeare
> Federico Fellini
Obsessed

·Anonymous C8.3 years ago, 5 minutes later, 20 hours after the original post[T] [B] #539,947

i didnt no ther wer other ironic shitters here.........

·Nugget Syntaxroll !Uvm54ORbmo8.3 years ago, 41 minutes later, 21 hours after the original post[T] [B] #539,948

@previous (C)
whoa whoa slow down bud
put down whatever drink you're having
you started sounding like bert

·Anonymous C8.3 years ago, 1 hour later, 22 hours after the original post[T] [B] #539,949

seething obsessed teenbro

·Nugget Syntaxroll !Uvm54ORbmo8.3 years ago, 3 minutes later, 22 hours after the original post[T] [B] #539,951

@previous (C)
wutever you say bud
just drop the drink
we just got rid of the old bert recently we dont need a replacement bert anytime soon

+Father Merrin !u5oFWxmY7U8.3 years ago, 9 hours later, 1 day after the original post[T] [B] #539,957

My heart sings with Godly joy when I see all the people in this thread who have chosen to remain virgins.

Start a new topic to continue this conversation.
Or browse the latest topics.

:

You are required to fill in a captcha for your first 5 posts. Sorry, but this is required to stop people from posting while drunk. Please be responsible and don't drink and post!
If you receive this often, consider not clearing your cookies.



Please familiarise yourself with the rules and markup syntax before posting.