Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

PHP

Name: Anonymous 2006-05-22 3:02

I was wondering if there was a better way of doing this so I dont look like a retard on the un-anonymous internets:

include("http//www.instructables/... .$project. "");

Thanks gurus of /prog/

Name: Anonymous 2006-05-22 3:39

>>1
Why the empty string at the end?

And no better way, but be very careful when including anything that has anything to do with a variable. For example, if it's not to be a directory or have arguments, assert so with a regex like /^\w+$/ . preg_match returns false if it won't match (regex, subject). Finally, it's generally preferred to avoid parenthesis in include and require because they are not functions but statements.

Name: Anonymous 2006-05-22 3:42

Hmm let me try leaving the empty part off, I am pretty sure it returned an error, brb and thanks for taking the time to look.

Name: Anonymous 2006-05-22 3:45

>>2
OK I get:
Parse error: parse error, unexpected T_STRING in /home/content/b/t/a/btard/html/getinst.php on line 24
include("http//www.instructable/... .$project.");

or
Parse error: parse error, unexpected ')' in /home/content/b/t/a/btard/html/getinst.php on line 20
from this
include("http//www.instructable/... .$project.);

Name: Anonymous 2006-05-22 4:21

>>4
This happens because you are using the string concatenation operator (dot) after $project without a second operand. Try:

include "http://..."; . $project

or just

include "http://...$project";

Name: Anonymous 2006-05-22 4:28

php: training wheels without the bike.

Name: Anonymous 2006-05-22 5:05 (sage)

>>1
You already look like a retard for using PHP, what else is there to lose?

Name: Anonymous 2006-05-22 6:10

>>6-7
You already look like retards for bashing PHP just because clueless people try to use it and fail, what else is there to lose?

Name: Anonymous 2006-05-22 11:24

The only reason to use PHP nowadays is because hosters don't support other superior languages. I have no problem with PHP. I used it for a long time and still like it, but it's a fact that better languages for mostly the same work exist. Use Ruby and Python if you have the chance to.

Name: Anonymous 2006-05-22 11:25

Okay, "no problem" is wrong. PHP _has_ it's problems (e.g. completly inconsistent standard library)

Name: Anonymous 2006-05-22 18:38

>>9
As a language, I like Python better than PHP, but admittedly, PHP is not that bad for what it does; it's pretty productive and reasonably clean for web sights (even large ones with separate presentation from data) and system scripting, and it's pleasuring to work with it if the code is good quality and you know what you're doing. There's no reason to bash it so much compared to other languages which have their share of problems as well.

Name: Anonymous 2006-05-22 21:36

reasonably clean

You have to be kidding.

You'd think several thousand (inconsistently named) functions in one namespace, many which do similar things (but not quite!) would be bad enough. But no, they had to add total stupidity like magic quotes, and that absolutely retarded site-wide configuration.

That's clean?! I don't want to know your definition of ugly!

Name: Anonymous 2006-05-23 6:03

>>12
Functions are a bit of a mess (although you end up using a subset of them which is usually reasonable).

Magic quotes, register globals (I wonder why you didn't mention this), and other "features" are absolute shit, but they are getting/got rid of them. You can use PHP with these disabled you know.

My definition of ugly is Perl, Java, Basic/Visual Basic, and poor PHP newb code.

Name: Anonymous 2006-05-23 7:06

Functions are a bit of a mess

I daresay that's an understatement.

they are getting/got rid of them.

I've learned never to wait for a language to get rid of stupidness. Take a look how long they've been working on Perl6 or Ruby2. It's been years.

Overall, I think we see mostly eye-to-eye. But why bother with PHP at all? Use Python, Ruby, or even the beast known as Perl.

Name: Anonymous 2006-05-23 7:46

>>14
PHP5 is out and I believe they are deprecated in PHP5.

I've been waiting for Perl6 and PHP6 but it seems they're always coming soon. As of today, I like Python best (and use it whenever I can), save for small system scripts, and I haven't used it for the web yet so I wouldn't know, but I'm pretty happy with PHP there (and I choose it over Perl for these tasks). I don't know Ruby yet.

Name: Anonymous 2006-05-23 19:32 (sage)

PHP5 NAMESPACE

Name: Anonymous 2006-05-26 13:40

include("http//www.instructable/... . $sProject);

>>14
PHP is closer to C and C is the best language ever. (C99 that is)

Name: Anonymous 2006-05-26 15:52

>>17
I think you misspelt Lisp as C.

Name: Anonymous 2006-05-26 17:06

>>18
No, PHP is much closer to C than it is to LISP.

Name: Anonymous 2006-05-27 0:38

>>19
I think he meant the "best language ever" comment, not the "PHP is closer to".

Name: Anonymous 2006-05-27 11:27 (sage)

>>20
Duuuuurrrrrr. Thank you for your insightful observation.

Name: Anonymous 2006-06-09 16:09

>>22
hey, thanks!

Name: Anonymous 2006-06-09 22:16 (sage)

>>23
>>22
GET BANNED

Name: Anonymous 2006-06-10 15:39

1. Post shit
2. Receev ban
3. PROFIT

Name: cherries 2006-06-16 5:55

After reading this thread a little more thourogly I now understand what your trying to achieve.
You see the "." operater in PHP is basicly the same thing as a + in any other langauge.
so when your trying to do this:

include("http//www.instructables/... .$project. "");

you should actually be doing this:

include("http://www.instructables/...".$project);

Hope this helped.

Name: Anonymous 2006-06-16 6:57

I never understood why some people appends or prepends PHP variables and constants with empty strings. I've seen this a lot in old PHP code, like echo "" . CONSTANT . "";

Name: Anonymous 2006-06-25 1:31

>>26
>You see the "." operater in PHP is basicly the same thing as a + in any other langauge.
fuck you, java/javascript (are there really any other languages that overload + for concatenation?) :(

Name: Anonymous 2006-06-25 9:01

>>29
BASIC

Name: Anonymous 2006-06-25 9:48

>>29
VB does it too, but it's considered bad form to use + when there's also &

Name: Anonymous 2006-06-25 14:50

>>29

You want to concatenate strings the Tcl way!

set SID "10"
set myStr "$myStr$SID"

Name: Anonymous 2006-06-25 20:19

>>29
Python uses +
Perl uses .

Name: Anonymous 2006-06-25 20:30

C-incremented has + for its string class, but C uses strcat and character arrays.

Name: Anonymous 2006-06-28 19:58

THAT'S C-POST-INCREMENTED YOU FUCKING DOLT

Name: Anonymous 2011-02-04 13:13

Name: Sgt.Kabu㬀㭄kiman㫑ḯ 2012-05-28 19:02

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List