Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

Token String

Posted on July 8, 2014October 26, 2015 By David Kittell

This PHP function will assist in splitting a string based on characters.

$string = "This istan examplenstring";
/* Use tab and newline as tokenizing characters as well  */
$tok = strtok($string, " nt");

while ($tok !== false) {
    echo "Word=$tok<br />";
    $tok = strtok(" nt");
}
$first_token  = strtok('/something', '/');
$second_token = strtok('/');
var_dump($first_token, $second_token);
string(0) ""
string(9) "something"
$first_token  = strtok('/something', '/');
$second_token = strtok('/');
var_dump($first_token, $second_token);
string(9) "something"
bool(false)

Source: http://www.php.net/manual/en/function.strtok.php

Originally Posted on July 8, 2014
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code PHP

Post navigation

Previous post
Next post

Related Posts

PowerShell – CSV Columns and Character Count

Posted on May 12, 2015October 26, 2015

$data = @(Import-Csv .partialFile.csv ) $row = $data[0] # how many columns do we have? $row | gm -membertype NoteProperty | Measure-Object # columns larger than 80 chars $row | gm -membertype NoteProperty | ? { ($row."$($_.Name)").Length -gt 80 } Reference: http://stackoverflow.com/questions/8685034/error-importing-5-gig-file-into-table Originally Posted on May 12, 2015Last Updated on…

Read More

Mac OSX Terminal – Lynx HTML Parsing

Posted on January 1, 2018

Lynx has a lot of good purposes but in this example below I’m simply going to strip URLs from a bookmarks HTML file exported from Chrome. brew install lynx lynx -dump -nonumbers -listonly bookmarks_11_18_16.html > links1.txt If you have created folders and links all over the place in Chrome or…

Read More

PowerShell – Rename Computer

Posted on November 10, 2015

# Rename Computer – Domain Login Rename-Computer -NewName Server044 -DomainCredential Domain01\Admin01 -Restart # Rename Computer – Local Login Rename-Computer -ComputerName Srv01 -NewName Server001 -LocalCredential Srv01\Admin01 -DomainCredential Domain01\Admin01 -Force -PassThru -Restart Reference: https://technet.microsoft.com/en-us/library/hh849792(v=wps.630).aspx All information on this site is shared with the intention to help. Before any source code or program…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • PowerShell - IIS Remove Site
  • SQLite - Auto-Increment / Auto Generate GUID
  • PowerShell - FTP Upload Directory With Sub-Directories

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • PowerShell - IIS Remove Site
  • SQLite - Auto-Increment / Auto Generate GUID
  • PowerShell - FTP Upload Directory With Sub-Directories
  • Raspberry Pi - Remove Default Apps
  • PowerShell - Change Windows CD/DVD Drive Letter
©2025 David Kittell | WordPress Theme by SuperbThemes