Skip to content

Instantly share code, notes, and snippets.

@devfabriciobr
Last active April 19, 2024 03:18
Show Gist options
  • Select an option

  • Save devfabriciobr/755078d8147915b1aa8e3f7c94a29552 to your computer and use it in GitHub Desktop.

Select an option

Save devfabriciobr/755078d8147915b1aa8e3f7c94a29552 to your computer and use it in GitHub Desktop.
PEGAR DADOS SEPARADOS DE UM TEXTO ( explode )
<?php
$nome_completo = 'FABRICIO ALMEIDA';
$array = explode(' ', $nome);
# RETORNO DO explode
Array
(
[0] => FABRICIO
[1] => ALMEIDA
)
$nnome = $array[0]; # FABRICIO
$sobrenome = $array[1]; # ALMEIDA
# OUTRO EXEMPLO:
$frutas = 'MAÇA, UVA, ABACAXI';
$array = explode(',', $frutas);
$maca = $array[0]; # MAÇA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment