Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Zephir Documentation for newcomers from PHP

My question is. Can we expect more deep comparission between code style PHP and Zephir?

For now it's very weak. For example as common example, we have to use double quotes instead of single quotes. In coomon Zephir give us some kind of error, but for example I was in stuck couple days why implode() function does nothing without any errors from Zephir side. Until I've looked carefully and find that I used implode('.', somearray); single quotes

Also I think there is necessary some explanation about how to use regular expression, because if I use it in PHP way, than I get something like that

"~(\S+)\\s+-\\s+(\\S+)~u" : "\\1 \- \\2"

/work/zephir-projects/foolzc/ext/foolzc/sphinxql/sphinxql.zep.c: In function 'zim_FoolzC_SphinxQL_SphinxQL_halfEscapeMatch':
/work/zephir-projects/foolzc/ext/foolzc/sphinxql/sphinxql.zep.c:2305:65: warning: unknown escape sequence: '\S' [enabled by default]
  add_assoc_stringl_ex(from_to_preg, SS("~(\S+)\\s+-\\s+(\\S+)~u"), SL("\\1 \\- \\2"), 1);
/work/zephir-projects/foolzc/ext/foolzc/sphinxql/sphinxql.zep.c:2305:65: warning: unknown escape sequence: '\S' [enabled by default]

In other words I have to use regular expression in a C way, not in PHP way. I understand that it's not a bug or issue, but I think this should be in documentation for devs which came from free-world of PHP.


edited Feb '16

Single and double quotes difference is mentioned in the docs: and

Zephir currently cannot detect badly escaped strings like in: "~(\S+)\\s+-\\s+(\\S+)~u" : "\\1 \- \\2" which has to be "~(\\S+)\\s+-\\s+(\\S+)~u" : "\\1 \- \\2"



Seems like I've read even line in documentation.

Zephir currently cannot detect badly escaped strings like in

I do not say that it's a bug or whatever. I just want to notice that we have to do make additional escapes.

Because I was in stuck whe I got that error in C debuger, so I went to SO and figured out why I got this errors which came from "C world".

It's look like I have to dust off my book about C...