search
HomePHP LibrariesOther librariesMobile PHP library for parsing strings
Mobile PHP library for parsing strings
<?php
if( file_exists(dirname(__FILE__).'/nicejson/nicejson.php') ) {
include_once dirname(__FILE__).'/nicejson/nicejson.php';
}
require_once dirname(__FILE__).'/../Mobile_Detect.php';
$detect = new Mobile_Detect;
$json = array(
// The current version of Mobile Detect class that
// is being exported.
'version' => $detect->getScriptVersion(),
// All headers that trigger 'isMobile' to be 'true',
// before reaching the User-Agent match detection.
'headerMatch' => $detect->getMobileHeaders(),
// All possible User-Agent headers.
'uaHttpHeaders' => $detect->getUaHttpHeaders(),
// All the regexes that trigger 'isMobile' or 'isTablet'
// to be true.
'uaMatch' => array(
// If match is found, triggers 'isMobile' to be true.
'phones'   => $detect->getPhoneDevices(),
// Triggers 'isTablet' to be true.
'tablets'  => $detect->getTabletDevices(),
// If match is found, triggers 'isMobile' to be true.
'browsers' => $detect->getBrowsers(),
// If match is found, triggers 'isMobile' to be true.
'os'       => $detect->getOperatingSystems(),
// Various utilities. To be further discussed.
'utilities' => $detect->getUtilities()
)
);

Strings are mainly used for programming. See the text for concept explanations, function explanations, and usage details. Here is an additional point: strings are similar to character arrays in storage, so each of its individual elements can be extracted. For example, s="abcdefghij", then s[1]="a", s[10]="j", and the zero position of the string is its length, such as s[0]=10 (※ The above function Ansistring No.), which can provide us with a lot of convenience. For example, each bit can be converted into a number and stored in an array during high-precision operations.

Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

PHP-ExcelReader: PHP class library for parsing excel files_PHP tutorialPHP-ExcelReader: PHP class library for parsing excel files_PHP tutorial

13Jul2016

PHP-ExcelReader: PHP class library for parsing excel files. PHP-ExcelReader: PHP class library for parsing excel files. PHP-ExcelReader is an open source project based on PHP. Its function is to parse excel files. The official website of PHP-ExcelReader is as follows:

Is There a Dedicated PHP Library for Parsing PDF Tables?Is There a Dedicated PHP Library for Parsing PDF Tables?

02Nov2024

Is There a PHP Library for Parsing PDFs?Question:I'm seeking a PDF parser for PHP. I need to extract a table from a PDF and convert it to an...

Is There a PHP Library for Parsing PDF Tables into Arrays?Is There a PHP Library for Parsing PDF Tables into Arrays?

02Nov2024

Is there a PHP library that can parse PDF files?You are looking for a PDF parser library for PHP. You need to extract data from a table inside a...

PHP class library for detecting mobile devices (cell phones)PHP class library for detecting mobile devices (cell phones)

08Aug2016

:This article mainly introduces the PHP class library for detecting mobile devices (mobile phones). Students who are interested in PHP tutorials can refer to it.

How Do I Link Static Libraries That Depend on Other Static Libraries?How Do I Link Static Libraries That Depend on Other Static Libraries?

13Dec2024

Linking Static Libraries to Other Static Libraries: A Comprehensive ApproachStatic libraries provide a convenient mechanism to package reusable...

How to import third-party libraries in ThinkPHPHow to import third-party libraries in ThinkPHP

03Jun2023

Third-party class libraries Third-party class libraries refer to other class libraries besides the ThinkPHP framework and application project class libraries. They are generally provided by third-party systems or products, such as class libraries of Smarty, Zend and other systems. For the class libraries imported earlier using automatic loading or the import method, the ThinkPHP convention is to use .class.php as the suffix. Non-such suffixes need to be controlled through the import parameters. But for the third type of library, since there is no such agreement, its suffix can only be considered to be php. In order to easily introduce class libraries from other frameworks and systems, ThinkPHP specifically provides the function of importing third-party class libraries. Third-party class libraries are uniformly placed in the ThinkPHP system directory/

See all articles