Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

echo newline #41

Open
jcubic opened this issue May 1, 2020 · 3 comments
Open

echo newline #41

jcubic opened this issue May 1, 2020 · 3 comments

Comments

@jcubic
Copy link

jcubic commented May 1, 2020

Example code:

<?php

echo "foo\nbar";

it prints foobar and it's not about html ignoring newline, the output is "foobar" in inspector.

@TysonAndre
Copy link

TysonAndre commented May 1, 2020

Part of the issue is that pib is meant to support HTML output windows (e.g. it supports HTML tags).
One way to fix this would be to add a setting to the menu to switch from HTML output to text output.

If you want to echo a newline, you'd have to echo "foo<br/>bar" or use <p>foo</p><p>bar</p>. I haven't checked why this isn't a space in pib. It could be the way webassembly forwards individual lines to JS, breaking on \n, but I haven't confirmed that for pib.

https://tysonandre.github.io/phan-demo/ (for https://github.com/tysonandre/phan-demo) is a fork of this that always uses text output (instead of HTML) for running php programs (and adds a PHP static analyzer as an example of an application that can run in web-assembly).
That may be a useful reference for implementing an alternative to treat CLI output as plaintext instead of HTML.

@jcubic
Copy link
Author

jcubic commented Aug 22, 2020

@seanmorris maybe you should create PR, but I'm not sure if contribution are accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants