- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1466 Articles for PHP
356 Views
The pathinfo() function returns information about a file path in an array. The pathinfo() function returns an associative array with the following elements −directory name − returns directory namebasename − returns basenameextension − returns extensionSyntaxpathinfo(path, options)Parameterspath − The path to be checked.options − Specify which of the elements to returnPATHINFO_DIRNAME - return only dirnamePATHINFO_BASENAME - return only basenamePATHINFO_EXTENSION - return only extensionReturnThe pathinfo() function returns an associative array with the following elements.directory name − returns directory namebasename − returns basenameextension − returns extensionThe following is an example showing all the information since we haven’t set the second parameter.Example Live DemoOutputArray ( ... Read More
81 Views
The parse_ini_string() function parses a configuration string. The function returns the settings as an associative array on success. It returns FALSE on failure.Syntaxparse_ini_string(file_path, process_sections)Parametersfile_path − The ini file to be parsed.process_sections − If set to TRUE, you will get a multidimensional array with section names and settings included.ReturnThe parse_ini_string() function returns the settings as an associative array on success. It returns FALSE on failure.Let’s say the content of our “demo.ini” is −[names] one = Anne [urls] host1 = "https://www.example1.com"ExampleOutputArray ( [one] => Anne [host1] => https://www.example1.com )Read More
467 Views
The parse_ini_file() function parses a configuration file (ini)Syntaxparse_ini_file(file_path, process_sections)Parametersfile_path − The ini file to be parsed.process_sections − If set to TRUE, you will get a multidimensional array with section names and settings included.ReturnThe parse_ini_file() function returns the settings as an associative array on success. It returns FALSE on failure.Let’s say the content of our “demo.ini” is −[names] one = Anne two = Katie three = Tom [urls] host1 = "https://www.example1.com" host2 = "https://www.example2.com"ExampleOutputArray ( [one] => Anne [two] => Katie [three] => Tom [host1] => https://www.example1.com [host2] => https://www.example2.com )Read More
2K+ Views
The move_uploaded_file() function moves an uploaded file to a new location. If the destination file already exists, it will be overwritten.Syntaxmove_uploaded_file(file_path, moved_path)Parametersfile_path − The file to be moved.moved_path − Where the file will be moved.ReturnThe move_uploaded_file() function returns true on success and false on failure.Example Live DemoOutputUpload failed!PHP Notice: Undefined index: userfile in /home/cg/root/8944881/main.php on line 2
175 Views
The mkdir() function is used to create a new directory.Syntaxmkdir(file_path, mode, recursive, context)Parametersfile_path − Path of the directory you want to create.mode − Specify permission.Set the mode with the following four values.zeropermission for ownerpermission for the owner’s user grouppermissions for restThe following are the values to set multiple permissions. You need to add the following numbers −1 = execute permissions2 = write permissions4 = read permissionsrecursive − Set recursive modecontext − The context of the file handle.ReturnThe mkdir() function returns TRUE on success and FALSE on failure.The following is an example that creates a new directory. This sets the default ... Read More
29 Views
The lstat() function returns information about a file or symbolic link. This function is similar to stat(), except that if the file parameter is a symbolic link, the status of the symlink is returned.The function returns an array with the below given elements −[0] or [dev] - Device number[1] or [ino] - Inode number[2] or [mode] - Inode protection mode[3] or [nlink] - Number of links[4] or [uid] - User ID of owner[5] or [gid] - Group ID of owner[6] or [rdev] - Inode device type[7] or [size] - Size in bytes[8] or [atime] - Last access time as Unix ... Read More
49 Views
The linkinfo() function returns information about a hard link. The function returns the device ID returned by the lstat system call. It returns 0 or FALSE in case of error.Syntaxlinkinfo(link_path)Parameterslink_path − The link of the path to check.ReturnThe linkinfo() function returns the device ID returned by the lstat system call. It returns 0 or FALSE in case of error.ExampleThe following is the output that returns the device ID.Output332Let us see another example.Example
26 Views
The lchown function changes user ownership of symbolic link. The function returns TRUE on success and FALSE on failure.Note − This function is not implemented on Windows platforms.Syntaxlchown(file_path, user)Parametersfile_path − Specify the path of file. Required.user − Specify user name or number.ReturnThe lchown() function returns TRUE on success and FALSE on failure.ExampleOutputTRUE
29 Views
The lchgrp() function changes group ownership of symlink. It returns TRUE on success and FALSE on failure.Note − Only the superuser may change the group of a symlink arbitrarily.Note − This function is not implemented on Windows platforms.Syntaxlchgrp(file_path, group)Parametersfile_path − Path to the symbolic link.group − Specify the group as name or number.ReturnThe lchgrp() function returns TRUE on success and FALSE on failure.ExampleOutputTRUE
To Continue Learning Please Login
Login with Google