Search code examples
phpsh

How to do multiline input in phpsh?


Can I something like:

php>multline start; 
.... $a =<<< EOF 
.... hello hi how are you this is phpSH 
.... hello there its test line 
.... EOF; 
.... multiline end; 

in phpsh?


Solution

  • Let's take an example, if multiline statement:

    1. Type: if (condition) {
    2. Just hit Enter
    3. ... and write what you want.
    4. } Close the multiline statement. And hit Enter to execute it.

    You can further cancel writing by hitting ctrl + c.