diff --git a/modules/31-advanced-strings/120-startwith/en/README.md b/modules/31-advanced-strings/120-startwith/en/README.md index e3499c0f..f32ceefb 100644 --- a/modules/31-advanced-strings/120-startwith/en/README.md +++ b/modules/31-advanced-strings/120-startwith/en/README.md @@ -3,15 +3,15 @@ When working with strings, you often need to determine whether one string — a ```php 6 +print_r(mb_strpos('Naïve Bayes', 'Bayes')); // => 6 ``` -The function returned `6` — the index of the letter `М`, where the substring begins. Indexes, as usual, are counted from zero: +The function returned `6` — the index of the letter `B`, where the substring begins. Indexes, as usual, are counted from zero: ```php 0 +print_r(mb_strpos('Naïve Bayes', 'Naïve')); // => 0 ``` Here it returned `0`: the substring was found at the very beginning of the string. @@ -21,7 +21,7 @@ If the substring isn't found, `mb_strpos()` returns the special value `false` (" ```php +print_r(mb_strpos('Naïve Bayes', 'Fisher')); // => ``` There's a hidden trap here that beginners often fall into: the result `0` ("found at the beginning of the string") is easy to confuse with `false` ("not found at all"). To tell them apart, you need a strict comparison — we'll cover it in the lessons about logic. For now, just remember: `mb_strpos()` answers the question "where?", not "is there?". diff --git a/modules/31-advanced-strings/120-startwith/es/README.md b/modules/31-advanced-strings/120-startwith/es/README.md index 0372c3dc..6425ecab 100644 --- a/modules/31-advanced-strings/120-startwith/es/README.md +++ b/modules/31-advanced-strings/120-startwith/es/README.md @@ -3,15 +3,15 @@ A menudo, al trabajar con cadenas de texto, es necesario determinar si una caden ```php 6 +print_r(mb_strpos('Feliz cumpleaños', 'cumpleaños')); // => 6 ``` -La función devolvió `6`: el índice de la letra `М`, donde comienza la subcadena. Los índices, como de costumbre, se cuentan desde cero: +La función devolvió `6`: el índice de la letra `c`, donde comienza la subcadena. Los índices, como de costumbre, se cuentan desde cero: ```php 0 +print_r(mb_strpos('Feliz cumpleaños', 'Feliz')); // => 0 ``` Aquí se devolvió `0`: la subcadena se encontró justo al inicio de la cadena. @@ -21,7 +21,7 @@ Si la subcadena no se encuentra, `mb_strpos()` devuelve el valor especial `false ```php +print_r(mb_strpos('Feliz cumpleaños', 'Navidad')); // => ``` Aquí se esconde una trampa en la que suelen caer los principiantes: el resultado `0` («encontrado al inicio de la cadena») es fácil de confundir con `false` («no encontrado en absoluto»). Para distinguirlos, se necesita una comparación estricta, que veremos en las lecciones sobre lógica. Por ahora, recuerda: `mb_strpos()` responde a la pregunta «¿dónde?», no «¿existe?». diff --git a/modules/33-data-types/40-primitive-data-types/en/README.md b/modules/33-data-types/40-primitive-data-types/en/README.md index 11d42e05..fd4e39d7 100644 --- a/modules/33-data-types/40-primitive-data-types/en/README.md +++ b/modules/33-data-types/40-primitive-data-types/en/README.md @@ -99,7 +99,3 @@ PHP primitive types Besides strings and numbers, PHP has the boolean type `bool` with the values `true` and `false`, as well as the special value `null`. We'll encounter them in more detail in the future. There are also composite types: arrays, objects, and others. We'll get to know them later. Moreover, in PHP you can create your own types (for example, classes), but first it's important to get a good grasp of the primitives. - -## Strings and lines - -In English, strings in programming are called **strings**, while lines of text files are called **lines**. In Russian there can be confusion, so throughout the lessons we'll say "строка" for the "string" data type and "строчка" for lines in files. diff --git a/modules/33-data-types/40-primitive-data-types/es/README.md b/modules/33-data-types/40-primitive-data-types/es/README.md index 09896fea..2fd50544 100644 --- a/modules/33-data-types/40-primitive-data-types/es/README.md +++ b/modules/33-data-types/40-primitive-data-types/es/README.md @@ -99,7 +99,3 @@ Tipos primitivos de PHP Además de las cadenas y los números, PHP tiene el tipo booleano `bool` con los valores `true` y `false`, así como el valor especial `null`. Nos encontraremos con ellos con más detalle en el futuro. También existen tipos compuestos: arrays, objetos y otros. Los conoceremos más adelante. Es más, en PHP se pueden crear tus propios tipos (por ejemplo, clases), pero primero es importante entender bien los primitivos. - -## Strings y lines - -En inglés, las cadenas de texto en programación se llaman **strings**, y las líneas de los archivos de texto se llaman **lines**. En ruso puede haber confusión, por eso en todas las lecciones diremos «строка» para referirnos al tipo de dato «cadena de texto», y «строчка» para las lines en los archivos.