Commit 9a991e7
committed
Add PHP to Zephir string conversion requirements
Added critical documentation about converting PHP strings to Zephir:
**Key Addition:**
When converting PHP code to Zephir, all single-quoted strings must be
converted to double-quoted strings and properly escaped following the
same escape rules as double-quoted strings in PHP.
**Why This Matters:**
- In PHP: Both 'text' and "text" create strings
- In Zephir: 'x' creates a char, "text" creates a string
- Single quotes in Zephir are exclusively for single characters (char type)
**Changes Made:**
1. **Dynamic Types Section:**
- Added note that strings must use double quotes (unlike PHP)
- Added "PHP to Zephir" conversion reminder
2. **String vs Char Section:**
- Added dedicated "Important for PHP to Zephir Conversion" subsection
- Provided side-by-side PHP vs Zephir code examples
- Showed escape sequence handling differences
3. **Common Pitfalls:**
- Added conversion reminder to string vs char confusion item
This prevents a common mistake when porting PHP code to Zephir where
developers might try to use single quotes for strings, which would
create char types instead.1 parent 1e718d7 commit 9a991e7
1 file changed
+22
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
271 | | - | |
| 271 | + | |
272 | 272 | | |
273 | 273 | | |
| 274 | + | |
274 | 275 | | |
275 | 276 | | |
276 | 277 | | |
| |||
320 | 321 | | |
321 | 322 | | |
322 | 323 | | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
323 | 343 | | |
324 | 344 | | |
325 | 345 | | |
| |||
1835 | 1855 | | |
1836 | 1856 | | |
1837 | 1857 | | |
| 1858 | + | |
1838 | 1859 | | |
1839 | 1860 | | |
1840 | 1861 | | |
| |||
0 commit comments