-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpracticas.php
More file actions
29 lines (23 loc) · 939 Bytes
/
practicas.php
File metadata and controls
29 lines (23 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta charset="UTF-8">
<title>Prácticas de clase</title>
</head>
<body>
<h2>Crear un string a partir de un array</h2>
<?php
//Función implode(caracter de división,$var_array) = devuelve una cadena de texto creada a partir de los elementos de un array, separándolos por el caracter de división
$emails=array("elena@cice.es","oscar@cice.es","jairo@cice.es","carmen@cice.es","solode@prueba.es");
$a= strlen(end($emails));
$string_emails=implode(", ", $emails);
$b= strlen($string_emails);
echo mb_substr($string_emails, 0, $b-$a-2)." y ".end($emails);
?>
</body>
</html>