strtok - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of strtok.php

  1. <?php
  2. $input = ["joao|pedreiro", "jose"];
  3. foreach($input as $text){
  4.     
  5.  
  6. $name = strtok($text, '|');
  7. $type = strtok($text);
  8.  
  9. var_dump(['name'=> $name, 'type' => $type]);
  10.  
  11. }
File Description
  • strtok
  • PHP Code
  • 18 Feb-2021
  • 173 Bytes
You can Share it: