Skip to main content
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

PHP, size 49, by bwoebiPHP, size 49, by bwoebi

print@substr(new exception,+~$$a+=++$$m+$$i+2+n); 

That was absolutely mental.

It got to

print@substr(new exception,); 

fairly quickly, at which point I needed something that gives -6 after the comma, having $++$++$++$+=$~main$2 left.

The main catch is that $a, $m and $i are all NULL, so using them indirectly in variable variables, means they all point to the same variable. However, PHP seems to be doing some weird things about resolving variable variables. With normal variables you can do things like

echo $a+$a=2; 

which prints 4 (the 2 is assigned to $a and then added to itself). But if I do the same with variable variables:

echo $$a+$$a=2; 

I get 2, because now the first $$a is evaluate before the assignment.

In the end I managed to force some order by putting some increments on the RHS of the += which had to be evaluated before that addition-assignment. That way I got to 5 which I could then just bit-complement. Still... there are some mysterious things going on, and I have no idea why half the things I tried worked and didn't work.

PHP, size 49, by bwoebi

print@substr(new exception,+~$$a+=++$$m+$$i+2+n); 

That was absolutely mental.

It got to

print@substr(new exception,); 

fairly quickly, at which point I needed something that gives -6 after the comma, having $++$++$++$+=$~main$2 left.

The main catch is that $a, $m and $i are all NULL, so using them indirectly in variable variables, means they all point to the same variable. However, PHP seems to be doing some weird things about resolving variable variables. With normal variables you can do things like

echo $a+$a=2; 

which prints 4 (the 2 is assigned to $a and then added to itself). But if I do the same with variable variables:

echo $$a+$$a=2; 

I get 2, because now the first $$a is evaluate before the assignment.

In the end I managed to force some order by putting some increments on the RHS of the += which had to be evaluated before that addition-assignment. That way I got to 5 which I could then just bit-complement. Still... there are some mysterious things going on, and I have no idea why half the things I tried worked and didn't work.

PHP, size 49, by bwoebi

print@substr(new exception,+~$$a+=++$$m+$$i+2+n); 

That was absolutely mental.

It got to

print@substr(new exception,); 

fairly quickly, at which point I needed something that gives -6 after the comma, having $++$++$++$+=$~main$2 left.

The main catch is that $a, $m and $i are all NULL, so using them indirectly in variable variables, means they all point to the same variable. However, PHP seems to be doing some weird things about resolving variable variables. With normal variables you can do things like

echo $a+$a=2; 

which prints 4 (the 2 is assigned to $a and then added to itself). But if I do the same with variable variables:

echo $$a+$$a=2; 

I get 2, because now the first $$a is evaluate before the assignment.

In the end I managed to force some order by putting some increments on the RHS of the += which had to be evaluated before that addition-assignment. That way I got to 5 which I could then just bit-complement. Still... there are some mysterious things going on, and I have no idea why half the things I tried worked and didn't work.

added 2 characters in body
Source Link
Martin Ender
  • 198.3k
  • 67
  • 455
  • 999

PHP, size 49, by bwoebi

print@substr(new exception,+~$$a+=++$$m+$$i+2+n); 

That was absolutely mental.

It got to

print@substr(new exception,); 

fairly quickly, at which point I needed something that gives -6 after the comma, having $++$++$++$+=$~main$2 left.

The main catch is that $a, $m and $i are all NULL, so using them indirectly in variable variables, means they all point to the same variable. However, PHP seems to be doing some weird things about resolving variable variables. With normal variables you can do things like

echo $a+$a=2;

echo $a+$a=2; 

which prints 4 (the 2 is assigned to $a and then added to itself). But if I do the same with variable variables:

echo $$a+$$a=2;

echo $$a+$$a=2; 

I get 2, because now the first $$a is evaluate before the assignment.

In the end I managed to force some order by putting some increments on the RHS of the += which had to be evaluated before that addition-assignment. That way I got to 5 which I could then just bit-complement. Still... there are some mysterious things going on, and I have no idea why half the things I tried worked and didn't work.

PHP, size 49, by bwoebi

print@substr(new exception,+~$$a+=++$$m+$$i+2+n); 

That was absolutely mental.

It got to

print@substr(new exception,); 

fairly quickly, at which point I needed something that gives -6 after the comma, having $++$++$++$+=$~main$2 left.

The main catch is that $a, $m and $i are all NULL, so using them indirectly in variable variables, means they all point to the same variable. However, PHP seems to be doing some weird things about resolving variable variables. With normal variables you can do things like

echo $a+$a=2;

which prints 4 (the 2 is assigned to $a and then added to itself). But if I do the same with variable variables:

echo $$a+$$a=2;

I get 2, because now the first $$a is evaluate before the assignment.

In the end I managed to force some order by putting some increments on the RHS of the += which had to be evaluated before that addition-assignment. That way I got to 5 which I could then just bit-complement. Still... there are some mysterious things going on, and I have no idea why half the things I tried worked and didn't work.

PHP, size 49, by bwoebi

print@substr(new exception,+~$$a+=++$$m+$$i+2+n); 

That was absolutely mental.

It got to

print@substr(new exception,); 

fairly quickly, at which point I needed something that gives -6 after the comma, having $++$++$++$+=$~main$2 left.

The main catch is that $a, $m and $i are all NULL, so using them indirectly in variable variables, means they all point to the same variable. However, PHP seems to be doing some weird things about resolving variable variables. With normal variables you can do things like

echo $a+$a=2; 

which prints 4 (the 2 is assigned to $a and then added to itself). But if I do the same with variable variables:

echo $$a+$$a=2; 

I get 2, because now the first $$a is evaluate before the assignment.

In the end I managed to force some order by putting some increments on the RHS of the += which had to be evaluated before that addition-assignment. That way I got to 5 which I could then just bit-complement. Still... there are some mysterious things going on, and I have no idea why half the things I tried worked and didn't work.

added 1094 characters in body
Source Link
Martin Ender
  • 198.3k
  • 67
  • 455
  • 999

PHP, size 49, by bwoebi

print@substr(new exception,+~$$a+=++$$m+$$i+2+n); 

That was absolutely mental.

It got to

print@substr(new exception,); 

fairly quickly, at which point I needed something that gives -6 after the comma, having $++$++$++$+=$~main$2 left.

The main catch is that $a, $m and $i are all NULL, so using them indirectly in variable variables, means they all point to the same variable. However, PHP seems to be doing some weird things about resolving variable variables. With normal variables you can do things like

echo $a+$a=2;

which prints 4 (the 2 is assigned to $a and then added to itself). But if I do the same with variable variables:

echo $$a+$$a=2;

I get 2, because now the first $$a is evaluate before the assignment.

In the end I managed to force some order by putting some increments on the RHS of the += which had to be evaluated before that addition-assignment. That way I got to 5 which I could then just bit-complement. Still... there are some mysterious things going on, and I have no idea why half the things I tried worked and didn't work.

PHP, size 49, by bwoebi

print@substr(new exception,+~$$a+=++$$m+$$i+2+n); 

That was absolutely mental.

PHP, size 49, by bwoebi

print@substr(new exception,+~$$a+=++$$m+$$i+2+n); 

That was absolutely mental.

It got to

print@substr(new exception,); 

fairly quickly, at which point I needed something that gives -6 after the comma, having $++$++$++$+=$~main$2 left.

The main catch is that $a, $m and $i are all NULL, so using them indirectly in variable variables, means they all point to the same variable. However, PHP seems to be doing some weird things about resolving variable variables. With normal variables you can do things like

echo $a+$a=2;

which prints 4 (the 2 is assigned to $a and then added to itself). But if I do the same with variable variables:

echo $$a+$$a=2;

I get 2, because now the first $$a is evaluate before the assignment.

In the end I managed to force some order by putting some increments on the RHS of the += which had to be evaluated before that addition-assignment. That way I got to 5 which I could then just bit-complement. Still... there are some mysterious things going on, and I have no idea why half the things I tried worked and didn't work.

Source Link
Martin Ender
  • 198.3k
  • 67
  • 455
  • 999
Loading