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

Pages: 1-4041-

PHP Questions!

Name: Anonymous 2008-06-03 17:12

<?php
if ($expression) {
    ?>
    <strong>This is true.</strong>
    <?php
} else {
    ?>
    <strong>This is false.</strong>
    <?php
}
?>

I am confused by this code.
Can anyone explain to me what happens if $expression is true? false?

Name: Anonymous 2008-06-03 17:15

if($expression) is a shortcut for writing if ($expression == TRUE)
and if (!$expression) a shortcut for if ($expression == FALSE)

Name: Anonymous 2008-06-03 17:48

Use code tags.

Name: Anonymous 2008-06-03 18:06

is anybody going to answer this?

Name: Anonymous 2008-06-03 18:24

>>4
DON'T HELP HIM!

Name: Anonymous 2008-06-03 18:29

>>4
/r/ fuqin angered copypasta, particularly the don't expect answers line.

Name: Anonymous 2008-06-03 18:29

>>5
He has already been helped so for him not to understand it still must mean he is a troll or a bloody idiot.

Name: Anonymous 2008-06-03 18:48

HAHAHAHA
YOU THINK YOURE THOUGH UH ?
I HAVE ONE WORD FOR YOU
  THE FORCED INDENTATION OF THE CODE
GET IT ?
I DONT THINK SO
YOU DONT KNOW ABOUT MY OTHER CAR I GUESS ?
ITS A CDR
AND IS PRONOUNCED ``CUDDER''
OK YOU FUQIN ANGERED AN EXPERT PROGRAMMER
THIS IS /prog/
YOU ARE ALLOWED TO POST HERE ONLY IF YOU HAVE ACHIEVED SATORI
PROGRAMMING IS ALL ABOUT ``ABSTRACT BULLSHITE'' THAT YOU WILL NEVER COMPREHEND
I HAVE READ SICP
IF ITS NOT DONE YOU HAVE TO
TOO BAD RUBY ON RAILS IS SLOW AS FUCK
BBCODE AND ((SCHEME)) ARE THE ULTIMATE LANGUAGES
ALSO
WELCOME TO /prog/
EVERY THREAD WILL BE REPLIED TO
NO EXCEPTIONS

Name: Anonymous 2008-06-03 19:22

>>8
How about the other one?

Name: Anonymous 2008-06-03 19:32

>>9
How about no?

Name: Anonymous 2008-06-03 20:00

This was an example of advanced escaping (according to php).
It's just hard to wrap my head around what exactly the php-engine is doing. For me, there's two ways of looking at this:
(1) PHP reads through the entire file, reassembles the fragmented code, and then interprets it. So the example would reassembled into <?php if ($expression) {} else {} ?>. Afterwards, anything between the appropriate curly braces would be outputted.
(2) PHP reads and evaluates in parts. It reads/evaluates if($expression) and if it's true it then tries to go into the block { but hits the closing tag ?> and pauses, outputting everything until the opening tag <?php and ending with }. But it must read the else statement and the { and then pause again for the closing tag ?>. Normally it would output anything beyond this tag, but it doesn't. Why? How does it know to prevent the HTML code from being output in this case. If this were C, it would be a matter of whether to jump to a block of code or not. But with broken code, it can't know what the block is unless it's read through the entire file as in (1). This is why here we assume it reads through everything sequentially and evaluates only what's necessary. Is that even possible to do?
I guess it stores the HTML code in order. Which means there is another option.
(3) It must make an entire php file out of the combination as follows
if ($expression) { echo "whatever was here in the file" }
else { echo "whatever was here in the file" }
Thats all I can think of.

Name: Anonymous 2008-06-03 21:11

First, Use The Source Luke.

Second, PHP fails and ultimately everything gets converted to a string to be EVALd.

Name: Anonymous 2008-06-03 23:00

>>11
because php is fucking shit and obfusticated

Name: Anonymous 2008-06-04 0:26

PHP is a bleeding fag-infested cunt

Name: Anonymous 2008-06-04 1:39

I think the output is
<strong>This is true.</strong>
<strong>This is false.</strong>
,
and OP is puzzled by this.

lol web programmers

Name: Anonymous 2008-06-04 1:49

>>1
use PerlHP instead.

Name: Anonymous 2008-06-04 6:41

>>15
And you're wrong.

Name: Anonymous 2008-06-04 8:15

And so PHP imitates HTML

Name: Anonymous 2008-06-04 16:10

>>17
Why?

Name: Anonymous 2008-06-04 19:56

>>19
Because you blurted something out that you don't understand
and you're puzzled by this.

Name: Anonymous 2008-06-05 6:33

>>1
Anything wrapped in <?php and ?> is considered by the PHP interpreter to be code. Anything outside that is regarded as data that may be sent back to the web browser.

So, the program you posted is equivalent to:

<?php
if ($expression) {
    print("<strong>This is true.</strong>");
} else {
    print("<strong>This is false.</strong>");
}
?>


(Actually that will differ slightly in the whitespace output, but it's functionally the same when the HTML is interpreted by the browser.)

Name: Anonymous 2008-06-05 14:27

>>21
Anything wrapped in <?php and ?> is considered harmful.

Name: Anonymous 2008-06-05 15:16

>>22
short_tags = true

Name: Anonymous 2008-06-05 15:27

>>23
magic_quotes = true

Name: Anonymous 2008-06-05 15:31

>>23
what

Name: Anonymous 2008-06-05 16:33

>>25
<?
if ($expression) {
    print("<strong>This is true.</strong>");
} else {
    print("<strong>This is false.</strong>");
}
?>

NOT HARMFUL

Name: Anonymous 2008-06-05 18:26

>>23,26
Faggots detected

Name: Anonymous 2008-06-05 20:36

i heard on the streets that php fags call it "echo" or some nonsense like that

Name: Anonymous 2008-06-05 21:30

>>28
They have echo, print, printf, and probably non-function syntaxes for all three.

Name: Anonymous 2008-06-07 3:03

[quote](quote)[/quote]

Name: Anonymous 2008-06-07 4:24

(unquote >>30)

Name: Anonymous 2008-06-07 16:23

addslashes(>>31)

Name: Anonymous 2008-06-07 19:40

>>29
I don't see the point, whatsoever, of echo not being a function. It's the biggest pile of faggotry I have ever whitnessed.

Name: Anonymous 2008-06-07 19:53

>>33
How do I whitnessed faggotry?

Name: Anonymous 2008-06-07 19:59

>>34
.u'i.o'anai mi na jbena lo glico bangu .i mi tavla fo la .lojban.

ki'e .i do bebna malglico .ui

co'o

Name: Anonymous 2008-06-07 20:04

>>35
Go back to bed, Christopher

Name: Anonymous 2008-06-07 20:06

>>35
/jp/ is that way --->

Name: Anonymous 2008-06-07 20:12

>>37

Actually, /jp/ is that way <-----

Name: Anonymous 2008-06-07 20:19

>>38
                           .
                          /|\
                           |
Actually, /jp/ is that way |

Name: Anonymous 2008-06-07 20:35


\
 \
  \
   \
   _\/

Name: Anonymous 2008-06-07 20:56

v              >  v
>0&>:  v v *_$:|  
   ^-1:_$>\:^  >$1>.@

Name: Anonymous 2008-06-07 21:18

#!/usr/bin/php -q
<?php
    $faggots = array("!","~","@","#","$","%","^","&","*","(",")");
    $x = intval($argv[1]);
  while ($x>0) {
        echo "
I AM A HUGE FAGGOT PLEASE RAPE MY FACE";
        while (rand(1,7)>1) {
    $DURR = $faggots[rand(0,11)];
    echo $DURR.$DURR.$DURR;}
        $x--;
    }
?>

Name: Anonymous 2008-06-08 18:32

>>42
I AM A HUGE FAGGOT PLEASE RAPE MY FACE@@@^^^(((~~~!!!***%%%@@@ I AM A HUGE FAGGOT PLEASE RAPE MY FACE^^^(((^^^

Name: Anonymous 2008-06-08 18:52

Why would anyone secretly issue ps x | grep firefox on my laptop while I was taking a leak? =/

Name: *scnr* 2008-06-08 18:56

asdasda

Name: ANOTHER QUESTION 2008-06-08 20:52

I'm having some trouble understanding the meaning of visibility.

    <?php

    class foobar {
        private $key1 = "cat";
        private $key2 = "apple";
        protected $key3 = "book";
        public $key4 = 42;

    }

    $obj = new foobar();
    // Trying to print the keys results in a PHP fatal error
    echo $obj->$key1;
    // Trying to make a copy of the keys results in a PHP fatal error
    $a = $obj->$key1;

    // However, the following works fine
    $a = (array) $obj;
    print_r( $a );

    array_values( $a );
    foreach( $a as $val )
        echo "$val\n";

    $b = $a[0];
    ?>

What is the point of the errors, or visibility for that matter, if the results can be
accomplished just as easily in
some other fashion.

Name: Anonymous 2008-06-09 8:34

Okay, now we're just being assholes. It's clear that /jp/ is that way
[code].__
|\
  \
   \
    \
     \[/code]

Name: Anonymous 2010-12-21 11:16

Name: Sgt.Kabukiman嬍륿 2012-05-23 15:03

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

Name: bampu pantsu 2012-05-29 3:42

bampu pantsu

Name: 2013-01-25 18:06

授⌶ᐴ眄❢錃䑐጖碈㊆㉶ȸ鉷眥堔⑥ض㌇茤畑瀓䦄ؑ݃⊀䤨ٰᢇ鑴坑ɶ鈐疆㞑ᎈ啵♶蘁☈敁ᜅᕗ㌤ᥣ閙煥→ႂ栰蕤дࠇ鐨灉憁ܡ䐙靔扵㒈剕偓ࠗ授契敕䚘ɕᐓѷ琉爸⁢蠥晅╁࢐呓㞆焨茢舡癦祗䆄႓ᘈ啓礕䤂灳酆ᔸ⤄祁恙㉓萇᥈䥲退脱栨椷嘠舘桧聵᠃䊄猘Ԉ㘒ሐ愐癀甤␙፷䄈ڄ䉩捙̖虤⍗挈ŧ㤘邉鉥䜳㐱ᐂ扸ᕵ≡腶刓ᕇ杓睳蕢鄠晲䕕恹鎀І吉㑗逈㙔恱硳㥹襐桉料ᅃ茔獥ȳ䍡顉䈴襇肀偱撆ぅ゙ᄸ敷㜦䅢䒁獑嘣∕Ͷ饢腣‶聓W鉦甑Ȃ除∄焧ࡅ䖁ᡶ䉗儶ᡥ╒⌹⅃蔗餲坴蘇r獣䜤㠀蠩⥤陒䊐〆傇ብ☳虲㘵傕厄ҙ⚉ᚒ㝩肄癑露陆遇䌒⊆愰玖閑䡔иƐ䑉荈ই恦鍣⤴᜘舗Չ㊖ᙷ爃㐢倶襨ᔡ週ၠ艀⌅皓ऑ㑤栒蕷茧㌸䀢舖鍃破剦腳斈ቱ͸堒㥦順煐荒膘牉捆瀁搸錴ᢀᑆ鐙锣䍧呦唁硤㌰㕀䅕ᠲ瑀饙䑵Љ㕤ㄈ桹✉℗㑱馅ሥ䄉兘ē〶憗卹⥶࠱᠅ॷ㌄瑠馄㥖鄔儣Ѳ薑ㅒታ䘹㑨䎂捅ᔂ⌂牖✀ʒ䔔ん遄挦⥣䀷䕧ᄁ⌵Ѕ鈣暗↗妔酦撓昷Ɂؕᤂ卧噠桐鑓ɒ㉠䘀唖玅甈兹摡㤉⥒儣ᠠՑ怹ݣ錃戂ᝂ數晆蠷⌙㑳s蒖堐阹ኙ搱码⥘墑皃ғ⍥֒㥕Ģ‗⤁呉癓瑱Ⅲ昤ͥᅸ救阀儖匕䐹夂熃Է榗圷青礤靑䤔袙㒆ᘕ怖銅扖㈁器⍆艢瑹蠒閆梅㥱碀頨隂祃぀䒀≸門ᥴग♶㤦眈荳妃࠴硇䊒ᅆ塥ɣ唥ȃ杅逩ࠓ昄ᙦ㑔ąᕉı⡩㈩ࡧ却㠓瘷耹炐∢锦獸頗戳奨督鄹啐夃唶✡琑᎒颂餠㙣ࡘ㐱領

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