7 replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
source | link

PHP, 22 21 20 18 bytes

This relies on PHP allowing one to give a function name to a variable and try to run it.

This simply concatenate the name of the pi function twice. This kills PHP with a Fatal Error: Uncaught Error: Call to undefined function pipi() in [...][...].

while($x.=pi)$x();

This works similar to my old answer.


Old answer, 20 bytes

PHP allows you to increment characters, using the increment operator. It only works on the a-z range, but is enough.

for($x=pi;;)$x=$x();

I believe this fulfills all the required points and the loop does run once.

You can see if because you will get the error Fatal error: Function name must be a string.


How this works, step by step:

  • Assign pi to $x.
    Since pi is being used as a constant, PHP will check if exists.
    Since it doesn't, PHP shows a warning saying Use of undefined constant pi - assumed 'pi' (Basically: since the constant doesn't exist, it is assumed to be a string)
  • Loop the first time
    • Run the function $x().
      Since $x has the value pi, it will run the function pi().
  • Store the value in $x.
    $x now has π, instead of pi
  • Loop for the second time
    • Run the function $x().
      Since $x has π, it will run the function 3.14159...().
    • π isn't a string, killing the program at this point with a Fatal Error.

Thanks to @Titus@Titus for finding the pi() function, saving me 1 byte!

PHP, 22 21 20 18 bytes

This relies on PHP allowing one to give a function name to a variable and try to run it.

This simply concatenate the name of the pi function twice. This kills PHP with a Fatal Error: Uncaught Error: Call to undefined function pipi() in [...][...].

while($x.=pi)$x();

This works similar to my old answer.


Old answer, 20 bytes

PHP allows you to increment characters, using the increment operator. It only works on the a-z range, but is enough.

for($x=pi;;)$x=$x();

I believe this fulfills all the required points and the loop does run once.

You can see if because you will get the error Fatal error: Function name must be a string.


How this works, step by step:

  • Assign pi to $x.
    Since pi is being used as a constant, PHP will check if exists.
    Since it doesn't, PHP shows a warning saying Use of undefined constant pi - assumed 'pi' (Basically: since the constant doesn't exist, it is assumed to be a string)
  • Loop the first time
    • Run the function $x().
      Since $x has the value pi, it will run the function pi().
  • Store the value in $x.
    $x now has π, instead of pi
  • Loop for the second time
    • Run the function $x().
      Since $x has π, it will run the function 3.14159...().
    • π isn't a string, killing the program at this point with a Fatal Error.

Thanks to @Titus for finding the pi() function, saving me 1 byte!

PHP, 22 21 20 18 bytes

This relies on PHP allowing one to give a function name to a variable and try to run it.

This simply concatenate the name of the pi function twice. This kills PHP with a Fatal Error: Uncaught Error: Call to undefined function pipi() in [...][...].

while($x.=pi)$x();

This works similar to my old answer.


Old answer, 20 bytes

PHP allows you to increment characters, using the increment operator. It only works on the a-z range, but is enough.

for($x=pi;;)$x=$x();

I believe this fulfills all the required points and the loop does run once.

You can see if because you will get the error Fatal error: Function name must be a string.


How this works, step by step:

  • Assign pi to $x.
    Since pi is being used as a constant, PHP will check if exists.
    Since it doesn't, PHP shows a warning saying Use of undefined constant pi - assumed 'pi' (Basically: since the constant doesn't exist, it is assumed to be a string)
  • Loop the first time
    • Run the function $x().
      Since $x has the value pi, it will run the function pi().
  • Store the value in $x.
    $x now has π, instead of pi
  • Loop for the second time
    • Run the function $x().
      Since $x has π, it will run the function 3.14159...().
    • π isn't a string, killing the program at this point with a Fatal Error.

Thanks to @Titus for finding the pi() function, saving me 1 byte!

6 added 276 characters in body
source | link

PHP, 22 21 20 18 bytes

This relies on PHP allowing one to give a function name to a variable and try to run it.

Also,This simply concatenate the name of the pi function twice. This kills PHP with a Fatal Error: Uncaught Error: Call to undefined function pipi() in [...][...].

while($x.=pi)$x();

This works similar to my old answer.


Old answer, 20 bytes

PHP allows you to increment characters, using the increment operator. It only works on the a-z range, but is enough.

for($x=pi;;)$x=$x();

I believe this fulfills all the required points and the loop does run once.

You can see if because you will get the error Fatal error: Function name must be a string.


How this works, step by step:

  • Assign pi to $x.
    Since pi is being used as a constant, PHP will check if exists.
    Since it doesn't, PHP shows a warning saying Use of undefined constant pi - assumed 'pi' (Basically: since the constant doesn't exist, it is assumed to be a string)
  • Loop the first time
    • Run the function $x().
      Since $x has the value pi, it will run the function pi().
  • Store the value in $x.
    $x now has π, instead of pi
  • Loop for the second time
    • Run the function $x().
      Since $x has π, it will run the function 3.14159...().
    • π isn't a string, killing the program at this point with a Fatal Error.

Thanks to @Titus for finding the pi() function, saving me 1 byte!

PHP, 22 20 bytes

This relies on PHP allowing one to give a function name to a variable and try to run it.

Also, PHP allows you to increment characters, using the increment operator. It only works on the a-z range, but is enough.

for($x=pi;;)$x=$x();

I believe this fulfills all the required points and the loop does run once.

You can see if because you will get the error Fatal error: Function name must be a string.


How this works, step by step:

  • Assign pi to $x.
    Since pi is being used as a constant, PHP will check if exists.
    Since it doesn't, PHP shows a warning saying Use of undefined constant pi - assumed 'pi' (Basically: since the constant doesn't exist, it is assumed to be a string)
  • Loop the first time
    • Run the function $x().
      Since $x has the value pi, it will run the function pi().
  • Store the value in $x.
    $x now has π, instead of pi
  • Loop for the second time
    • Run the function $x().
      Since $x has π, it will run the function 3.14159...().
    • π isn't a string, killing the program at this point with a Fatal Error.

Thanks to @Titus for finding the pi() function, saving me 1 byte!

PHP, 22 21 20 18 bytes

This relies on PHP allowing one to give a function name to a variable and try to run it.

This simply concatenate the name of the pi function twice. This kills PHP with a Fatal Error: Uncaught Error: Call to undefined function pipi() in [...][...].

while($x.=pi)$x();

This works similar to my old answer.


Old answer, 20 bytes

PHP allows you to increment characters, using the increment operator. It only works on the a-z range, but is enough.

for($x=pi;;)$x=$x();

I believe this fulfills all the required points and the loop does run once.

You can see if because you will get the error Fatal error: Function name must be a string.


How this works, step by step:

  • Assign pi to $x.
    Since pi is being used as a constant, PHP will check if exists.
    Since it doesn't, PHP shows a warning saying Use of undefined constant pi - assumed 'pi' (Basically: since the constant doesn't exist, it is assumed to be a string)
  • Loop the first time
    • Run the function $x().
      Since $x has the value pi, it will run the function pi().
  • Store the value in $x.
    $x now has π, instead of pi
  • Loop for the second time
    • Run the function $x().
      Since $x has π, it will run the function 3.14159...().
    • π isn't a string, killing the program at this point with a Fatal Error.

Thanks to @Titus for finding the pi() function, saving me 1 byte!

5 deleted 67 characters in body
source | link

PHP, 22 2120 bytes

This relies on PHP allowing one to give a function name to a variable and try to run it.

Also, PHP allows you to increment characters, using the increment operator. It only works on the a-z range, but is enough.

for($x=pi;;++$x$x=pi;;)$x$x=$x();

I believe this fulfills all the required points and the loop does run once.

You can see if because you will get the error Fatal error: Uncaught Error: Call toFunction undefinedname functionmust pj()be ina [...][...]:Nstring.


How this works, step by step:

  • Assign pi to $x.
    Since pi is being used as a constant, PHP will check if exists.
    Since it doesn't, PHP shows a warning saying Use of undefined constant pi - assumed 'pi' (Basically: since the constant doesn't exist, it is assumed to be a string)
  • Loop the first time
    • Run the function $x().
      Since $x has the value pi, it will run the function pi().
  • IncrementStore the value ofin $x.
    $x now has the value pjπ, instead of pi
  • Loop for the second time
    • Run the function $x().
      Since $x has the value pjπ, it will run the function pj3.14159...().
    • The function pj() doesn't existπ isn't a string, killing the program at this point with a Fatal Error.

Thanks to @Titus for finding the pi() function, saving me 1 byte!

PHP, 22 21 bytes

This relies on PHP allowing one to give a function name to a variable and try to run it.

Also, PHP allows you to increment characters, using the increment operator. It only works on the a-z range, but is enough.

for($x=pi;;++$x)$x();

I believe this fulfills all the required points and the loop does run once.

You can see if because you will get the error Fatal error: Uncaught Error: Call to undefined function pj() in [...][...]:N.


How this works, step by step:

  • Assign pi to $x.
    Since pi is being used as a constant, PHP will check if exists.
    Since it doesn't, PHP shows a warning saying Use of undefined constant pi - assumed 'pi' (Basically: since the constant doesn't exist, it is assumed to be a string)
  • Loop the first time
    • Run the function $x().
      Since $x has the value pi, it will run the function pi().
  • Increment the value of $x.
    $x now has the value pj, instead of pi
  • Loop for the second time
    • Run the function $x().
      Since $x has the value pj, it will run the function pj().
    • The function pj() doesn't exist, killing the program at this point with a Fatal Error.

Thanks to @Titus for finding the pi() function, saving me 1 byte!

PHP, 22 20 bytes

This relies on PHP allowing one to give a function name to a variable and try to run it.

Also, PHP allows you to increment characters, using the increment operator. It only works on the a-z range, but is enough.

for($x=pi;;)$x=$x();

I believe this fulfills all the required points and the loop does run once.

You can see if because you will get the error Fatal error: Function name must be a string.


How this works, step by step:

  • Assign pi to $x.
    Since pi is being used as a constant, PHP will check if exists.
    Since it doesn't, PHP shows a warning saying Use of undefined constant pi - assumed 'pi' (Basically: since the constant doesn't exist, it is assumed to be a string)
  • Loop the first time
    • Run the function $x().
      Since $x has the value pi, it will run the function pi().
  • Store the value in $x.
    $x now has π, instead of pi
  • Loop for the second time
    • Run the function $x().
      Since $x has π, it will run the function 3.14159...().
    • π isn't a string, killing the program at this point with a Fatal Error.

Thanks to @Titus for finding the pi() function, saving me 1 byte!

4 added 149 characters in body
source | link
3 Fixed oversight, doesn't change anything at all
source | link
2 added 779 characters in body
source | link
1
source | link