Posts by Alê Moraes • 883 points
61 posts
-
5
votes1
answer6034
viewsQ: Explode in PHP returns Undefined offset: 1
function extrai($string) { $peca1 = explode('id="', $string); $peca2 = explode('">', $peca1[1]); return $peca2[0]; } To string that’s the one: < ul class="artigo" id="artigo1"> < li>…
phpasked Alê Moraes 883 -
3
votes1
answer158
viewsQ: Does not return the variable value
I put the code in Paste bin: http://pastebin.com/vG6BSpuu foreach ($linhas as $novalinha){ $novoTituloSlug = get_string_between($novalinha, 'id="', '">'); echo $novoTituloSlug; $novalinhas =…
phpasked Alê Moraes 883 -
2
votes2
answers111
viewsQ: $_GET['id'] does not return value
I do a search with in mysql, but $_GET['id'] does not show, although it shows in the address bar : http://localhost/t-shirts/index.php? funcao=edit$id=18 $sql = mysqli_query($conexao, "SELECT * FROM…
phpasked Alê Moraes 883 -
0
votes0
answers46
viewsQ: Concatenate list hierarchy
I have this html scenario in php. <ul id="titulo1"></ul> <ul id="capitulo1"></ul> <ul id="artigo1"></ul> <ul id="artigo2"></ul> <ul…
phpasked Alê Moraes 883 -
1
votes2
answers612
viewsA: Regex to select only numbers from 1 to 2,000
I was studying and arrived at a much simpler solution. $artigo = explode(" ", $novalinhas); $caracteres = array("º","."); $artigos = str_replace($caracteres, "", $artigo[1]);…
-
1
votes2
answers612
viewsQ: Regex to select only numbers from 1 to 2,000
I’m doing a search to return the article numbers, used: preg_match_all('/\d+/', $novalinhas, $matches); $artigo = (int)implode('',$matches[0]); It is working, however, in some articles it picks more…
-
0
votes0
answers62
viewsQ: Splits text in ul with id of string content
The laws are actually a list of items, with sub-items. I copied the code below and the example is in this link http://preliminarte.com.br/converter.php I was able to make php read the plain text…
phpasked Alê Moraes 883 -
7
votes2
answers305
viewsQ: I know the variable value, but the switch only goes to the default
After a search, I get the following result: // O resultado desta linha é I ou II ou III; echo $subsecao; // O resultado desta linha é string; echo gettype($subsecao); // Faço um switch para atribuir…
-
1
votes1
answer412
viewsQ: Return number with Regular Expression
I have a list of articles from Art. 1 to Art. 2.040., but in each article there are other numbers. I would like to make an expression that: 1 - Capture the numbers always after the string "Art. "…
-
2
votes1
answer246
viewsQ: Assign id according to text content
I don’t know if it’s better Javascript, PHP, or even the sublime text, but, I copied the text of cf and pasted on a txt (to get rid of those weird tags) then in the sublime text, I: selected…
-
2
votes1
answer391
viewsQ: Check if you have the string and include its tags
I would like to take the content of the site, remove only the text and insert my tags, but in this code I did, when he finds the text "Art" he does not leave the if, and then, only the first ones…
phpasked Alê Moraes 883