note 127988 added to function.shmop-write

From: Date: Wed, 07 Dec 2022 07:55:36 +0000
Subject: note 127988 added to function.shmop-write
Groups: php.notes 
Request: Send a blank email to php-notes+get-219944@lists.php.net to get a copy of this message
On thing you might want to do is replace an old string with a shorter one, or to clear out the string altogether. To replace the string, you can zero-byte pad the string you are writing: <?php // $shmid is from shmop_open() $size = 128; $string = 'something'; // write $string = str_pad(string, $size, "\0"); shmop_write($shmid, $string, 0); // read print rtrim(shmop($shmid,0,0),,"\0"); // clear $string = str_repeat("\0",$size); shmop_write($shmid, $string, 0); ?> ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.159.161 (proxied: 159.196.219.235) ---- Manual Page -- https://php.net/manual/en/function.shmop-write.php Edit -- https://main.php.net/note/edit/127988 Del: integrated -- https://main.php.net/note/delete/127988/integrated Del: useless -- https://main.php.net/note/delete/127988/useless Del: bad code -- https://main.php.net/note/delete/127988/bad+code Del: spam -- https://main.php.net/note/delete/127988/spam Del: non-english -- https://main.php.net/note/delete/127988/non-english Del: in docs -- https://main.php.net/note/delete/127988/in+docs Del: other reasons-- https://main.php.net/note/delete/127988 Reject -- https://main.php.net/note/reject/127988 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#219944) next »